From 9f54be62d90fdbe8c77e213ba8001cda5a07d5d9 Mon Sep 17 00:00:00 2001 From: LeonidLapshin Date: Mon, 20 Jan 2025 13:25:28 +0100 Subject: [PATCH] added an option to specify the docker_config_path for custom runners --- .gflows/libs/build_publish_steps.lib.yml | 4 +++- .gflows/libs/job_docker_publish_alicloud.lib.yml | 2 +- .gflows/libs/job_docker_publish_github.lib.yml | 2 +- .gflows/libs/job_publish_nuget.lib.yml | 4 ++++ .gflows/libs/job_scan_code_net.lib.yml | 1 + .../build-publish/settings.yml | 2 ++ github-sample/workflows/build-publish.yml | 13 +++++++++++++ 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.gflows/libs/build_publish_steps.lib.yml b/.gflows/libs/build_publish_steps.lib.yml index 66264e0..4e7f2f8 100644 --- a/.gflows/libs/build_publish_steps.lib.yml +++ b/.gflows/libs/build_publish_steps.lib.yml @@ -73,7 +73,7 @@ with: check_run_annotations: none # Disable additional annotations to reduce API calls #@ end --- -#@ def _copy_between_registries_step(tag_from, tag_to, target_registry_name): +#@ def _copy_between_registries_step(tag_from, tag_to, target_registry_name, docker_config_path): name: #@ "Push Image to {}".format(target_registry_name) uses: akhilerm/tag-push-action@v2.1.0 with: @@ -84,6 +84,8 @@ with: # quay.io/user/app:1.0.0 # ghcr.io/user/app:latest # ghcr.io/user/app:1.0.0 + docker-config-path: #@ docker_config_path + #/home/myuser/.docker/config.json #@ end --- #@ def _setup_cosign(): diff --git a/.gflows/libs/job_docker_publish_alicloud.lib.yml b/.gflows/libs/job_docker_publish_alicloud.lib.yml index b69c786..fa04903 100644 --- a/.gflows/libs/job_docker_publish_alicloud.lib.yml +++ b/.gflows/libs/job_docker_publish_alicloud.lib.yml @@ -72,7 +72,7 @@ run: | - #@ steps.login_docker(sections.main_registry) #@ get_versions_tags_id = common.job_id(image_section,"alicloud-tags-") - #@ _get_versions(image_section, get_versions_tags_id, sections) -- #@ bpsteps.copy_between_registries_step(tagging.image(sections.cache_registry, image_section),"${{ steps." + get_versions_tags_id + ".outputs.docker_image_ali_cloud_tags }}",sections.main_registry.name) +- #@ bpsteps.copy_between_registries_step(tagging.image(sections.cache_registry, image_section),"${{ steps." + get_versions_tags_id + ".outputs.docker_image_ali_cloud_tags }}",sections.main_registry.name,sections.main_registry.docker_config_path) - #@ helmsteps.update_helmchart("${{ needs.version.outputs.app_version }}") - #@ bpsteps.setup_cosign() - #@ bpsteps.sign_container_with_cosign(tagging.with_registry(sections.main_registry.url,image_section.image_name,"${{ needs.version.outputs.app_version }}"), "${{ needs." + job.id.docker_build(image_section) + ".outputs.digest }}") diff --git a/.gflows/libs/job_docker_publish_github.lib.yml b/.gflows/libs/job_docker_publish_github.lib.yml index 35cfab2..49eda66 100644 --- a/.gflows/libs/job_docker_publish_github.lib.yml +++ b/.gflows/libs/job_docker_publish_github.lib.yml @@ -66,7 +66,7 @@ run: | #@ get_versions_tags_id = common.job_id(image_section,"github-tags-") - #@ steps.checkout() - #@ _get_versions(image_section, get_versions_tags_id, sections) -- #@ bpsteps.copy_between_registries_step(tagging.candidate_image(sections.cache_registry, image_section),"${{ steps." + get_versions_tags_id + ".outputs.docker_image_ghcr_tags }}",sections.cache_registry.name) +- #@ bpsteps.copy_between_registries_step(tagging.candidate_image(sections.cache_registry, image_section),"${{ steps." + get_versions_tags_id + ".outputs.docker_image_ghcr_tags }}",sections.cache_registry.name,sections.cache_registry.docker_config_path) - #@ bpsteps.setup_cosign() - #@ bpsteps.sign_container_with_cosign(tagging.with_registry(sections.cache_registry.url,image_section.image_name,"${{ needs.version.outputs.app_version }}"), "${{ needs." + job.id.docker_build(image_section) + ".outputs.digest }}") #@ end diff --git a/.gflows/libs/job_publish_nuget.lib.yml b/.gflows/libs/job_publish_nuget.lib.yml index 87d4e53..5814575 100644 --- a/.gflows/libs/job_publish_nuget.lib.yml +++ b/.gflows/libs/job_publish_nuget.lib.yml @@ -12,6 +12,10 @@ with: name: Nuget packages path: ./nuget +- name: Setup Dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 7.x - name: Push generated package to GitHub registry run: dotnet nuget push ./nuget/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --source https://nuget.pkg.github.com/covergo/index.json - name: Push generated package symbols to GitHub registry diff --git a/.gflows/libs/job_scan_code_net.lib.yml b/.gflows/libs/job_scan_code_net.lib.yml index 351bf99..049e601 100644 --- a/.gflows/libs/job_scan_code_net.lib.yml +++ b/.gflows/libs/job_scan_code_net.lib.yml @@ -45,6 +45,7 @@ - name: SonarCloud Scan run: | dotnet tool install --global dotnet-sonarscanner + export PATH="$PATH:/root/.dotnet/tools" dotnet sonarscanner begin /k:"${{ github.repository_owner }}_${{ github.event.repository.name }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /o:covergo /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml dotnet build --configuration Release dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" diff --git a/.gflows/workflow-configuration/build-publish/settings.yml b/.gflows/workflow-configuration/build-publish/settings.yml index 86769ff..d32dbac 100644 --- a/.gflows/workflow-configuration/build-publish/settings.yml +++ b/.gflows/workflow-configuration/build-publish/settings.yml @@ -240,6 +240,7 @@ cache_registry: url: ghcr.io name: GitHub Container Registry user: ${{ github.repository_owner }} + docker_config_path: /home/runner/.docker/config.json # password: ${{ secrets.CR_PAT_FULL }} main_registry: @@ -251,6 +252,7 @@ main_registry: #default branches: - main + docker_config_path: /home/runner/.docker/config.json scan_code_net: name: Sonar Code diff --git a/github-sample/workflows/build-publish.yml b/github-sample/workflows/build-publish.yml index c9eed45..de2a368 100644 --- a/github-sample/workflows/build-publish.yml +++ b/github-sample/workflows/build-publish.yml @@ -79,6 +79,7 @@ jobs: - name: SonarCloud Scan run: | dotnet tool install --global dotnet-sonarscanner + export PATH="$PATH:/root/.dotnet/tools" dotnet sonarscanner begin /k:"${{ github.repository_owner }}_${{ github.event.repository.name }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /o:covergo /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml dotnet build --configuration Release dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" @@ -182,6 +183,10 @@ jobs: with: name: Nuget packages path: ./nuget + - name: Setup Dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 7.x - name: Push generated package to GitHub registry run: dotnet nuget push ./nuget/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --source https://nuget.pkg.github.com/covergo/index.json - name: Push generated package symbols to GitHub registry @@ -266,6 +271,10 @@ jobs: with: name: Nuget packages path: ./nuget + - name: Setup Dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 7.x - name: Push generated package to GitHub registry run: dotnet nuget push ./nuget/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --source https://nuget.pkg.github.com/covergo/index.json - name: Push generated package symbols to GitHub registry @@ -955,6 +964,7 @@ jobs: with: src: ghcr.io/covergo/auth:candidate-${{ needs.version.outputs.app_version }} dst: ${{ steps.github-tags-auth-service.outputs.docker_image_ghcr_tags }} + docker-config-path: /home/runner/.docker/config.json - name: Set up sigstore cosign uses: sigstore/cosign-installer@main - name: Sign published container image @@ -1020,6 +1030,7 @@ jobs: with: src: ghcr.io/covergo/auth:${{ needs.version.outputs.app_version }} dst: ${{ steps.alicloud-tags-auth-service.outputs.docker_image_ali_cloud_tags }} + docker-config-path: /home/runner/.docker/config.json - if: github.ref_type == 'tag' name: Publish helm chart uses: peter-evans/repository-dispatch@v2 @@ -1082,6 +1093,7 @@ jobs: with: src: ghcr.io/covergo/auth-predeployment:candidate-${{ needs.version.outputs.app_version }} dst: ${{ steps.github-tags-auth-predeployment.outputs.docker_image_ghcr_tags }} + docker-config-path: /home/runner/.docker/config.json - name: Set up sigstore cosign uses: sigstore/cosign-installer@main - name: Sign published container image @@ -1147,6 +1159,7 @@ jobs: with: src: ghcr.io/covergo/auth-predeployment:${{ needs.version.outputs.app_version }} dst: ${{ steps.alicloud-tags-auth-predeployment.outputs.docker_image_ali_cloud_tags }} + docker-config-path: /home/runner/.docker/config.json - if: github.ref_type == 'tag' name: Publish helm chart uses: peter-evans/repository-dispatch@v2