Skip to content

Commit dab7822

Browse files
committed
Use a shared GH action for signing into JFrog artificatory and fetching GoProxy URL
Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
1 parent 416e2a7 commit dab7822

File tree

4 files changed

+23
-80
lines changed

4 files changed

+23
-80
lines changed

.github/workflows/golang.yml

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,18 @@ jobs:
4545
version: latest
4646
args: -v --timeout 5m
4747
skip-cache: true
48-
- name: Setup JFrog CLI
49-
id: jfrog
50-
uses: jfrog/setup-jfrog-cli@v4
51-
env:
52-
JF_URL: https://${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}/
53-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
54-
with:
55-
oidc-provider-name: nvgithub
56-
oidc-audience: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
57-
cache: true
48+
- name: Setup Go Proxy
49+
id: setup-go-proxy
50+
uses: nv-gha-runners/setup-artifactory-go-proxy@main
5851
- name: Check golang modules
5952
env:
60-
OIDC_USER: ${{ steps.jfrog.outputs.oidc-user }}
61-
OIDC_TOKEN: ${{ steps.jfrog.outputs.oidc-token }}
62-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
53+
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
6354
run: |
64-
OIDC_USER_ENCODED=$(python3 -c 'import urllib.parse, os; print(urllib.parse.quote_plus(os.environ["OIDC_USER"]))')
65-
export GOPROXY="https://${OIDC_USER_ENCODED}:${OIDC_TOKEN}@${OIDC_ARTIFACTORY_ENDPOINT}/artifactory/api/go/edge-go-remote-virtual"
6655
make check-vendor
6756
- name: Check generated assets
6857
env:
69-
OIDC_USER: ${{ steps.jfrog.outputs.oidc-user }}
70-
OIDC_TOKEN: ${{ steps.jfrog.outputs.oidc-token }}
71-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
58+
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
7259
run: |
73-
OIDC_USER_ENCODED=$(python3 -c 'import urllib.parse, os; print(urllib.parse.quote_plus(os.environ["OIDC_USER"]))')
74-
export GOPROXY="https://${OIDC_USER_ENCODED}:${OIDC_TOKEN}@${OIDC_ARTIFACTORY_ENDPOINT}/artifactory/api/go/edge-go-remote-virtual"
7560
make validate-generated-assets
7661
test:
7762
name: Unit test
@@ -91,24 +76,13 @@ jobs:
9176
uses: actions/setup-go@v5
9277
with:
9378
go-version: ${{ env.GOLANG_VERSION }}
94-
- name: Setup JFrog CLI
95-
id: jfrog
96-
uses: jfrog/setup-jfrog-cli@v4
97-
env:
98-
JF_URL: https://${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}/
99-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
100-
with:
101-
oidc-provider-name: nvgithub
102-
oidc-audience: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
103-
cache: true
79+
- name: Setup Go Proxy
80+
id: setup-go-proxy
81+
uses: nv-gha-runners/setup-artifactory-go-proxy@main
10482
- name: Run Coverage
10583
env:
106-
OIDC_USER: ${{ steps.jfrog.outputs.oidc-user }}
107-
OIDC_TOKEN: ${{ steps.jfrog.outputs.oidc-token }}
108-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
84+
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
10985
run: |
110-
OIDC_USER_ENCODED=$(python3 -c 'import urllib.parse, os; print(urllib.parse.quote_plus(os.environ["OIDC_USER"]))')
111-
export GOPROXY="https://${OIDC_USER_ENCODED}:${OIDC_TOKEN}@${OIDC_ARTIFACTORY_ENDPOINT}/artifactory/api/go/edge-go-remote-virtual"
11286
make coverage
11387
build:
11488
name: Build
@@ -128,22 +102,11 @@ jobs:
128102
uses: actions/setup-go@v5
129103
with:
130104
go-version: ${{ env.GOLANG_VERSION }}
131-
- name: Setup JFrog CLI
132-
id: jfrog
133-
uses: jfrog/setup-jfrog-cli@v4
134-
env:
135-
JF_URL: https://${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}/
136-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
137-
with:
138-
oidc-provider-name: nvgithub
139-
oidc-audience: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
140-
cache: true
105+
- name: Setup Go Proxy
106+
id: setup-go-proxy
107+
uses: nv-gha-runners/setup-artifactory-go-proxy@main
141108
- name: Run Build
142109
env:
143-
OIDC_USER: ${{ steps.jfrog.outputs.oidc-user }}
144-
OIDC_TOKEN: ${{ steps.jfrog.outputs.oidc-token }}
145-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
110+
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
146111
run: |
147-
OIDC_USER_ENCODED=$(python3 -c 'import urllib.parse, os; print(urllib.parse.quote_plus(os.environ["OIDC_USER"]))')
148-
export GOPROXY="https://${OIDC_USER_ENCODED}:${OIDC_TOKEN}@${OIDC_ARTIFACTORY_ENDPOINT}/artifactory/api/go/edge-go-remote-virtual"
149112
make build

.github/workflows/image.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,15 @@ jobs:
6262
registry: ghcr.io
6363
username: ${{ github.actor }}
6464
password: ${{ secrets.GITHUB_TOKEN }}
65-
- name: Setup JFrog CLI
66-
id: jfrog
67-
uses: jfrog/setup-jfrog-cli@v4
68-
env:
69-
JF_URL: https://${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}/
70-
with:
71-
oidc-provider-name: nvgithub
72-
oidc-audience: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
73-
cache: true
65+
- name: Setup Go Proxy
66+
id: setup-go-proxy
67+
uses: nv-gha-runners/setup-artifactory-go-proxy@main
7468
- name: Build image
7569
env:
7670
IMAGE_NAME: ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-nim-operator
7771
VERSION: ${COMMIT_SHORT_SHA}-arm64
78-
OIDC_USER: ${{ steps.jfrog.outputs.oidc-user }}
79-
OIDC_TOKEN: ${{ steps.jfrog.outputs.oidc-token }}
80-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
72+
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
8173
run: |
82-
OIDC_USER_ENCODED=$(python3 -c 'import urllib.parse, os; print(urllib.parse.quote_plus(os.environ["OIDC_USER"]))')
83-
export GOPROXY="https://${OIDC_USER_ENCODED}:${OIDC_TOKEN}@${OIDC_ARTIFACTORY_ENDPOINT}/artifactory/api/go/edge-go-remote-virtual"
8474
echo "${VERSION}"
8575
make -f deployments/container/Makefile build
8676
build-image-amd64:
@@ -122,25 +112,15 @@ jobs:
122112
registry: ghcr.io
123113
username: ${{ github.actor }}
124114
password: ${{ secrets.GITHUB_TOKEN }}
125-
- name: Setup JFrog CLI
126-
id: jfrog
127-
uses: jfrog/setup-jfrog-cli@v4
128-
env:
129-
JF_URL: https://${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}/
130-
with:
131-
oidc-provider-name: nvgithub
132-
oidc-audience: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
133-
cache: true
115+
- name: Setup Go Proxy
116+
id: setup-go-proxy
117+
uses: nv-gha-runners/setup-artifactory-go-proxy@main
134118
- name: Build image
135119
env:
136120
IMAGE_NAME: ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-nim-operator
137121
VERSION: ${COMMIT_SHORT_SHA}-amd64
138-
OIDC_USER: ${{ steps.jfrog.outputs.oidc-user }}
139-
OIDC_TOKEN: ${{ steps.jfrog.outputs.oidc-token }}
140-
OIDC_ARTIFACTORY_ENDPOINT: ${{ secrets.OIDC_ARTIFACTORY_ENDPOINT }}
122+
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
141123
run: |
142-
OIDC_USER_ENCODED=$(python3 -c 'import urllib.parse, os; print(urllib.parse.quote_plus(os.environ["OIDC_USER"]))')
143-
export GOPROXY="https://${OIDC_USER_ENCODED}:${OIDC_TOKEN}@${OIDC_ARTIFACTORY_ENDPOINT}/artifactory/api/go/edge-go-remote-virtual"
144124
echo "${VERSION}"
145125
make -f deployments/container/Makefile build
146126
build-image-multi-arch:

deployments/container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM golang:${GOLANG_VERSION} AS builder
55
ARG TARGETOS
66
ARG TARGETARCH
77

8-
ARG GOPROXY=direct
8+
ARG GOPROXY="https://proxy.golang.org,direct"
99
ENV GOPROXY=$GOPROXY
1010

1111
WORKDIR /workspace

deployments/container/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ OUT_IMAGE_VERSION ?= $(IMAGE_VERSION)
4747
OUT_IMAGE_TAG = $(OUT_IMAGE_VERSION)
4848
OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_TAG)
4949

50-
GOPROXY ?= direct
50+
GOPROXY ?= https://proxy.golang.org,direct
5151

5252
# DEFAULT_CHANNEL defines the default channel used in the bundle.
5353
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")

0 commit comments

Comments
 (0)