Skip to content

Commit c66dd5d

Browse files
Shiva Kumarshivakunv
authored andcommitted
Tag git commit sha with bundle image
Signed-off-by: Shiva Kumar (SW-CLOUD) <[email protected]>
1 parent 456f414 commit c66dd5d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ name: CI
1717
on:
1818
push:
1919
branches:
20-
- "pull-request/[0-9]+"
21-
- main
22-
- release-*
20+
- bundlecommitsha
21+
2322

2423
concurrency:
2524
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number || github.ref }}
@@ -426,7 +425,7 @@ jobs:
426425
regctl image copy ${OPERATOR_IMAGE}:${OPERATOR_VERSION} ${OPERATOR_IMAGE}:main-latest
427426
428427
push-gpu-operator-bundle-image:
429-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Runs only if the event is a push to the main branch
428+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/bundlecommitsha' }} # Runs only if the event is a push to the main branch
430429
needs: [release-latest-gpu-operator-image]
431430
runs-on: linux-amd64-cpu4
432431
steps:
@@ -441,6 +440,7 @@ jobs:
441440
- name: Build bundle-image
442441
env:
443442
BUNDLE_IMAGE: "ghcr.io/nvidia/gpu-operator/gpu-operator-bundle:${{ github.ref_name }}-latest"
443+
BUNDLE_IMAGE_TAG: "ghcr.io/nvidia/gpu-operator/gpu-operator-bundle:${COMMIT_SHORT_SHA}"
444444
VERSION: ""
445445
DEFAULT_CHANNEL: "stable"
446446
CHANNELS: "stable"

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
6060
# BUNDLE_IMAGE defines the image:tag used for the bundle.
6161
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMAGE=<some-registry>/<project-name-bundle>:<tag>)
6262
BUNDLE_IMAGE ?= gpu-operator-bundle:$(VERSION)
63+
BUNDLE_IMAGE_TAG ?= gpu-operator-bundle:$(VERSION)
6364

6465
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
6566
ifeq (,$(shell go env GOBIN))
@@ -131,11 +132,12 @@ build-bundle-image:
131132
$(DOCKER) build \
132133
--build-arg DEFAULT_CHANNEL=$(DEFAULT_CHANNEL) \
133134
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
134-
-f docker/bundle.Dockerfile -t $(BUNDLE_IMAGE) .
135+
-f docker/bundle.Dockerfile -t $(BUNDLE_IMAGE) -t $(BUNDLE_IMAGE_TAG) .
135136

136137
# Push the bundle image.
137138
push-bundle-image: build-bundle-image
138139
$(DOCKER) push $(BUNDLE_IMAGE)
140+
$(DOCKER) push $(BUNDLE_IMAGE_TAG)
139141

140142
# Define local and dockerized golang targets
141143

0 commit comments

Comments
 (0)