diff --git a/.github/workflows/multi-arch-image-build.yaml b/.github/workflows/multi-arch-image-build.yaml index 6c85bdf..c3052b7 100644 --- a/.github/workflows/multi-arch-image-build.yaml +++ b/.github/workflows/multi-arch-image-build.yaml @@ -13,6 +13,9 @@ concurrency: group: march-build-${{ github.ref }} cancel-in-progress: true +env: + tag: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }} + jobs: image-build: uses: konveyor/release-tools/.github/workflows/build-push-images.yaml@main @@ -26,3 +29,40 @@ jobs: secrets: registry_username: ${{ secrets.QUAY_PUBLISH_ROBOT }} registry_password: ${{ secrets.QUAY_PUBLISH_TOKEN }} + + windows-image-build: + runs-on: windows-latest + steps: + - uses: actions/checkout@main + - name: Login to Docker Hub + uses: docker/login-action@master + with: + registry: "quay.io/konveyor" + username: ${{ secrets.QUAY_PUBLISH_ROBOT }} + password: ${{ secrets.QUAY_PUBLISH_TOKEN }} + - name: Build static-report + run: | + docker build -f ./Dockerfile.windows -t quay.io/konveyor/kantra:$env:tag-windowsservercore-ltsc2022 . + docker push quay.io/konveyor/kantra:$env:tag-windowsservercore-ltsc2022 + + update-manifest: + needs: + - image-build + - windows-image-build + runs-on: ubuntu-latest + steps: + - name: update manifest + run: | + podman manifest create temp + podman manifest add temp --all quay.io/konveyor/kantra:${tag} + podman manifest add temp --all quay.io/konveyor/kantra:${tag}-windowsservercore-ltsc2022 + podman tag temp quay.io/konveyor/kantra:${tag} + - name: Push manifest to Quay + uses: redhat-actions/push-to-registry@main + id: push + with: + image: konveyor/kantra + tags: ${{ env.tag }} + username: ${{ secrets.QUAY_PUBLISH_ROBOT }} + password: ${{ secrets.QUAY_PUBLISH_TOKEN }} + registry: quay.io diff --git a/Dockerfile.windows b/Dockerfile.windows index fde24ff..be8a6a5 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -1,6 +1,6 @@ ARG VERSION=latest -# FROM quay.io/konveyor/static-report:${VERSION} as static-report +FROM quay.io/konveyor/static-report:${VERSION} as static-report FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS rulesets SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -61,8 +61,8 @@ RUN md C:\opt\rulesets\input C:\opt\rulesets\convert C:\opt\openrewrite C:\opt\i # Copy the executable from the builder stage COPY --from=builder /workspace/kantra.exe . COPY --from=rulesets /rulesets/default/generated/dotnet8 /opt/rulesets -#COPY --from=static-report /usr/bin/js-bundle-generator . -#COPY --from=static-report /usr/local/static-report . +COPY --from=static-report /usr/bin/js-bundle-generator . +COPY --from=static-report /usr/local/static-report ./static-report # Command to run the executable ENTRYPOINT ["kantra.exe"] diff --git a/cmd/analyze.go b/cmd/analyze.go index b31eaa4..588543c 100644 --- a/cmd/analyze.go +++ b/cmd/analyze.go @@ -2017,11 +2017,16 @@ func (a *analyzeCommand) analyzeDotnetFramework(ctx context.Context) error { return err } - // TODO(djzager): uncomment when provider handles mode correctly - //if a.mode == string(provider.FullAnalysisMode) { - // a.log.V(1).Info("Only source mode analysis is supported") - // a.mode = string(provider.SourceOnlyAnalysisMode) - //} + if a.bulk { + err := fmt.Errorf("Unsupported option") + a.log.Error(err, "Bulk analysis not supported for .NET Framework projects") + return err + } + + if a.mode == string(provider.FullAnalysisMode) { + a.log.V(1).Info("Only source mode analysis is supported") + a.mode = string(provider.SourceOnlyAnalysisMode) + } var err error @@ -2215,11 +2220,48 @@ func (a *analyzeCommand) analyzeDotnetFramework(ctx context.Context) error { } // Generate Static Report - err = a.GenerateStaticReport(ctx) + if a.skipStaticReport { + return nil + } + + err = container.NewContainer().Run( + ctx, + container.WithImage(Settings.RunnerImage), + container.WithLog(a.log.V(1)), + container.WithContainerToolBin(Settings.PodmanBinary), + container.WithEntrypointBin("powershell"), + container.WithEntrypointArgs("Copy-Item", `C:\app\static-report\`, "-Recurse", filepath.FromSlash(OutputPath)), + container.WithVolumes(volumes), + container.WithCleanup(a.cleanup), + ) + if err != nil { + return err + } + + staticReportArgs := []string{ + fmt.Sprintf(`-output-path=C:\%s\static-report\output.js`, filepath.FromSlash(OutputPath)), + fmt.Sprintf("-analysis-output-list=C:%s", filepath.FromSlash(AnalysisOutputMountPath)), + fmt.Sprintf("-application-name-list=%s", filepath.Base(a.input)), + } + + //staticReportContainer := container.NewContainer() + a.log.Info("generating static report", "output", a.output, "args", staticReportArgs) + err = container.NewContainer().Run( + ctx, + container.WithImage(Settings.RunnerImage), + container.WithLog(a.log.V(1)), + container.WithContainerToolBin(Settings.PodmanBinary), + container.WithEntrypointBin(`C:\app\js-bundle-generator`), + container.WithEntrypointArgs(staticReportArgs...), + container.WithVolumes(volumes), + container.WithCleanup(a.cleanup), + ) if err != nil { - a.log.Error(err, "failed to generate static report") return err } + uri := uri.File(filepath.Join(a.output, "static-report", "index.html")) + a.log.Info("Static report created. Access it at this URL:", "URL", string(uri)) + return nil }