@@ -29,9 +29,6 @@ defaults:
29
29
run :
30
30
shell : bash
31
31
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
-
35
32
concurrency :
36
33
group : ${{ github.ref_name }}-ci
37
34
cancel-in-progress : true
@@ -48,11 +45,27 @@ jobs:
48
45
min_k8s_version : ${{ steps.vars.outputs.min_k8s_version }}
49
46
k8s_latest : ${{ steps.vars.outputs.k8s_latest }}
50
47
helm_changes : ${{ steps.filter.outputs.charts }}
48
+ goproxy : ${{ steps.goproxy.outputs.goproxy }}
51
49
steps :
52
50
- name : Checkout Repository
53
51
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
54
52
with :
55
53
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
56
69
57
70
- name : Setup Golang Environment
58
71
uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
92
105
name : Unit Tests
93
106
runs-on : ubuntu-24.04
94
107
needs : vars
108
+ env :
109
+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
95
110
steps :
96
111
- name : Checkout Repository
97
112
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -144,6 +159,8 @@ jobs:
144
159
name : Build Binary
145
160
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' }}
146
161
needs : [vars, unit-tests, njs-unit-tests]
162
+ env :
163
+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
147
164
permissions :
148
165
contents : write # for goreleaser/goreleaser-action and lucacome/draft-release to create/update releases
149
166
id-token : write # for goreleaser/goreleaser-action to sign artifacts
@@ -345,6 +362,8 @@ jobs:
345
362
name : CEL Tests
346
363
runs-on : ubuntu-24.04
347
364
needs : vars
365
+ env :
366
+ GOPROXY : ${{ needs.vars.outputs.goproxy }}
348
367
steps :
349
368
- name : Checkout Repository
350
369
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
0 commit comments