diff --git a/.github/actions/image-builder/action.yml b/.github/actions/image-builder/action.yml index 0590293949ca..bd529177eaeb 100644 --- a/.github/actions/image-builder/action.yml +++ b/.github/actions/image-builder/action.yml @@ -78,7 +78,7 @@ runs: id: prepare-tags shell: bash - - uses: docker://europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240624-9aa7af85 + - uses: docker://europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240626-2f46eb74 id: build with: args: --name=${{ inputs.image-name }} --context=${{ inputs.context }} --dockerfile=${{ inputs.dockerfile }} --azure-access-token=${{ inputs.ado-token }} --oidc-token=${{ inputs.oidc-token }} ${{ steps.prepare-build-args.outputs.build-args }} ${{ steps.prepare-tags.outputs.tags }} --export-tags=${{ inputs.export-tags }} --config=${{ inputs.config }} --env-file=${{ inputs.env-file }} --build-in-ado=true \ No newline at end of file diff --git a/cmd/image-builder/main.go b/cmd/image-builder/main.go index 3578e1e5eef8..cd9bbc44d34f 100644 --- a/cmd/image-builder/main.go +++ b/cmd/image-builder/main.go @@ -345,7 +345,7 @@ func buildInADO(o options) error { if err != nil { fmt.Printf("Can't read ADO pipeline run logs, failed creating ADO build client, err: %s", err) } - logs, err := adopipelines.GetRunLogs(ctx, adoBuildClient, &http.Client{}, o.AdoConfig.GetADOConfig(), pipelineRun.Id, o.azureAccessToken) + logs, err = adopipelines.GetRunLogs(ctx, adoBuildClient, &http.Client{}, o.AdoConfig.GetADOConfig(), pipelineRun.Id, o.azureAccessToken) if err != nil { fmt.Printf("Failed read ADO pipeline run logs, err: %s", err) } else { @@ -360,9 +360,11 @@ func buildInADO(o options) error { // buildInADO should return required data and caller should handle it. // if run in github actions, set output parameters if o.ciSystem == GithubActions { + fmt.Println("Setting GitHub outputs.") var images []string if !o.dryRun { images = extractImagesFromADOLogs(logs) + fmt.Printf("Extracted built images from ADO logs: %v\n", images) } else { fmt.Println("Running in dry-run mode. Skipping extracting images and results from ADO.") images = []string{"registry/repo/image1:tag1", "registry/repo/image2:tag2"} @@ -372,8 +374,16 @@ func buildInADO(o options) error { return fmt.Errorf("cannot marshal list of images: %w", err) } - actions.SetOutput("images", string(data)) - actions.SetOutput("adoResult", string(*pipelineRunResult)) + err = actions.SetOutput("images", string(data)) + if err != nil { + return fmt.Errorf("cannot set images GitHub output: %w", err) + } + fmt.Println("images GitHub output set") + err = actions.SetOutput("adoResult", string(*pipelineRunResult)) + if err != nil { + return fmt.Errorf("cannot set adoResult GitHub output: %w", err) + } + fmt.Println("adoResult GitHub output set") } // Handle the ADO pipeline run failure.