@@ -29,9 +29,6 @@ defaults:
2929 run :
3030 shell : bash
3131
32- env :
33- GOPROXY : ${{ (github.repository_owner == 'nginx' && (inputs.is_production_release || github.event_name == 'push' && github.ref == 'refs/heads/main') && format('https://{0}:{1}@{2}', secrets.ARTIFACTORY_USER, secrets.ARTIFACTORY_TOKEN, secrets.ARTIFACTORY_ENDPOINT)) || (github.repository_owner == 'nginx' && format('https://{0}:{1}@{2}', secrets.ARTIFACTORY_USER, secrets.ARTIFACTORY_TOKEN, secrets.ARTIFACTORY_DEV_ENDPOINT) || 'direct') }}
34-
3532concurrency :
3633 group : ${{ github.ref_name }}-ci
3734 cancel-in-progress : true
@@ -48,11 +45,27 @@ jobs:
4845 min_k8s_version : ${{ steps.vars.outputs.min_k8s_version }}
4946 k8s_latest : ${{ steps.vars.outputs.k8s_latest }}
5047 helm_changes : ${{ steps.filter.outputs.charts }}
48+ goproxy : ${{ steps.goproxy.outputs.goproxy }}
5149 steps :
5250 - name : Checkout Repository
5351 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5452 with :
5553 fetch-depth : 0
54+ - name : Configure GOPROXY
55+ id : goproxy
56+ run : |
57+ if [[ "${{ secrets.ARTIFACTORY_USER }}" == "" ]]; then
58+ echo "No Artifactory secrets available - using direct GOPROXY"
59+ GOPROXY_VALUE="direct"
60+ elif [[ "${{ inputs.is_production_release }}" == "true" ]] || [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
61+ echo "Production mode - using production Artifactory"
62+ GOPROXY_VALUE="https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_ENDPOINT }}"
63+ else
64+ echo "Development mode - using dev Artifactory"
65+ GOPROXY_VALUE="https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_DEV_ENDPOINT }}"
66+ fi
67+ echo "goproxy=${GOPROXY_VALUE}" >> $GITHUB_OUTPUT
68+ echo "GOPROXY=${GOPROXY_VALUE}" >> $GITHUB_ENV
5669
5770 - name : Setup Golang Environment
5871 uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
92105 name : Unit Tests
93106 runs-on : ubuntu-24.04
94107 needs : vars
108+ env :
109+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
95110 steps :
96111 - name : Checkout Repository
97112 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -144,6 +159,8 @@ jobs:
144159 name : Build Binary
145160 runs-on : ${{ github.repository_owner == 'nginx' && (inputs.is_production_release || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ubuntu-24.04-amd64' || 'ubuntu-24.04' }}
146161 needs : [vars, unit-tests, njs-unit-tests]
162+ env :
163+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
147164 permissions :
148165 contents : write # for goreleaser/goreleaser-action and lucacome/draft-release to create/update releases
149166 id-token : write # for goreleaser/goreleaser-action to sign artifacts
@@ -345,6 +362,8 @@ jobs:
345362 name : CEL Tests
346363 runs-on : ubuntu-24.04
347364 needs : vars
365+ env :
366+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
348367 steps :
349368 - name : Checkout Repository
350369 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
0 commit comments