Skip to content

Commit 2fe2260

Browse files
Merge pull request #153 from almaslennikov/docker-base-image
pass updated urls to base images in the fork CI job
2 parents 5cf1c06 + 3037877 commit 2fe2260

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

.github/workflows/fork-ci-reusable.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ jobs:
108108
DOCKER_REGISTRY: ${{ needs.determine_docker_registry_and_tag.outputs.docker_registry }}
109109
DOCKER_TAG: ${{ needs.determine_docker_registry_and_tag.outputs.docker_tag }}
110110
GOPROXY: ${{ secrets.goproxy || 'direct' }}
111+
BASE_IMAGE_DOCA_FULL_RT_HOST: nvcr.io/nvidia/doca/doca:3.0.0-full-rt-host
112+
BASE_IMAGE_GO_DISTROLESS_DEV: nvcr.io/nvidia/distroless/go:v3.1.12-dev
113+
BASE_IMAGE_GO_DISTROLESS: nvcr.io/nvidia/distroless/go:v3.1.12
111114
strategy:
112115
matrix:
113116
component: ${{ fromJSON(inputs.components) }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Sync Dockerfile image tags to reusable workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
actions: write
12+
13+
jobs:
14+
sync:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Extract image tags from Dockerfile
19+
id: extract
20+
run: |
21+
doca=$(awk '/ AS BASE_IMAGE_DOCA_FULL_RT_HOST/ {print $2; exit}' Dockerfile)
22+
go_dev=$(awk '/ AS BASE_IMAGE_GO_DISTROLESS_DEV/ {print $2; exit}' Dockerfile)
23+
go_base=$(awk '/ AS BASE_IMAGE_GO_DISTROLESS($|\s)/ {print $2; exit}' Dockerfile)
24+
echo "doca=$doca" >> $GITHUB_OUTPUT
25+
echo "go_dev=$go_dev" >> $GITHUB_OUTPUT
26+
echo "go_base=$go_base" >> $GITHUB_OUTPUT
27+
- name: Update fork-ci-reusable.yml envs if needed
28+
id: update
29+
env:
30+
DOCA: ${{ steps.extract.outputs.doca }}
31+
GO_DEV: ${{ steps.extract.outputs.go_dev }}
32+
GO_BASE: ${{ steps.extract.outputs.go_base }}
33+
run: |
34+
file=.github/workflows/fork-ci-reusable.yml
35+
sed -E -i "s#^([[:space:]]*BASE_IMAGE_DOCA_FULL_RT_HOST:)\s*.*#\\1 ${DOCA}#" "$file"
36+
sed -E -i "s#^([[:space:]]*BASE_IMAGE_GO_DISTROLESS_DEV:)\s*.*#\\1 ${GO_DEV}#" "$file"
37+
sed -E -i "s#^([[:space:]]*BASE_IMAGE_GO_DISTROLESS:)\s*.*#\\1 ${GO_BASE}#" "$file"
38+
if git diff --quiet --exit-code -- "$file"; then
39+
echo "changed=false" >> $GITHUB_OUTPUT
40+
else
41+
echo "changed=true" >> $GITHUB_OUTPUT
42+
fi
43+
- name: Create Pull Request
44+
if: steps.update.outputs.changed == 'true'
45+
env:
46+
GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
47+
run: |
48+
git config user.name "nvidia-ci-cd"
49+
git config user.email "[email protected]"
50+
BRANCH="chore/sync-dockerfile-images-$(date +%Y%m%d%H%M%S)"
51+
git checkout -b "$BRANCH"
52+
git add .github/workflows/fork-ci-reusable.yml
53+
git commit -m "chore: sync image tags in fork-ci-reusable.yml from Dockerfile"
54+
git push --set-upstream origin "$BRANCH"
55+
gh pr create \
56+
--title "chore: sync image tags in fork-ci-reusable.yml" \
57+
--body $'This PR updates the following envs in `.github/workflows/fork-ci-reusable.yml` based on `Dockerfile`:\n- BASE_IMAGE_DOCA_FULL_RT_HOST\n- BASE_IMAGE_GO_DISTROLESS_DEV\n- BASE_IMAGE_GO_DISTROLESS' \
58+
--base main \
59+
--head "$BRANCH"
60+
61+

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This is a dummy Dockerfile for getting dependabot PRs for version updates
2+
FROM nvcr.io/nvidia/doca/doca:3.1.0-full-rt-host AS BASE_IMAGE_DOCA_FULL_RT_HOST
3+
FROM nvcr.io/nvidia/distroless/go:v3.1.13-dev AS BASE_IMAGE_GO_DISTROLESS_DEV
4+
FROM nvcr.io/nvidia/distroless/go:v3.1.13 AS BASE_IMAGE_GO_DISTROLESS

0 commit comments

Comments
 (0)