Skip to content

Commit

Permalink
build(trident): add custom tag to images
Browse files Browse the repository at this point in the history
Signed-off-by: Clément Nussbaumer <[email protected]>
  • Loading branch information
clementnuss committed Oct 25, 2024
1 parent 426ce9c commit ab84f8b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/trident.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
# github.ref == 'refs/heads/main' &&
# github.ref == 'refs/heads/main' &&
if: |
!github.event.pull_request.head.repo.fork
Expand Down Expand Up @@ -42,11 +42,44 @@ jobs:
working-directory: trident-distrowith/trident
env:
BUILD_TYPE: stable
run: make images
run: |
export CUSTOM_IMAGE_TAG=pf-$(echo $GITHUB_REF_NAME | tr "/" "-") && \
make images
- name: List docker images
run: docker image ls

- name: Export docker images as artifacts
run: |
mkdir -p /tmp/docker-images/
docker image ls --format=json | \
jq -s '[.[] | select(.Repository | test("ghcr.io/postfinance/trident.*"))] | unique_by(.ID) |.[] | .Repository + ":" + .Tag' | \
xargs -I_ docker save _ -o /tmp/docker-images/_.tar
- name: Upload docker images artifacts
uses: actions/upload-artifact@v4
with:
name: custom-trident-images
path: /tmp/docker-images/*.tar

publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: custom-trident-images
path: docker-images/

- name: Display structure of downloaded files
run: find .

- name: Load image(s)
run: |
find docker-images/ -name "*.tar" -exec docker load --input {} \;
docker image ls
- name: Log in to ghcr.io registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

Expand Down
17 changes: 14 additions & 3 deletions trident-distrowith/makefile.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
--- Makefile.original 2024-10-24 20:45:15
+++ Makefile 2024-10-24 20:45:37
--- trident/Makefile.original 2024-10-25 09:11:22
+++ trident/Makefile 2024-10-25 09:21:23
@@ -93,7 +93,7 @@

# Constants
ALL_PLATFORMS = linux/amd64 linux/arm64 windows/amd64/ltsc2022 windows/amd64/ltsc2019 darwin/amd64
-DEFAULT_REGISTRY = docker.io/netapp
+DEFAULT_REGISTRY = ghcr.io/postfinance
TRIDENT_CONFIG_PKG = github.com/netapp/trident/config
OPERATOR_CONFIG_PKG = github.com/netapp/trident/operator/config
TRIDENT_KUBERNETES_PKG = github.com/netapp/trident/persistent_store/crd
@@ -120,8 +120,9 @@
TRIDENT_VERSION := $(VERSION)-$(BUILD_TYPE).$(BUILD_TYPE_REV)
endif

+CUSTOM_IMAGE_TAG ?=
# tag variables
-TRIDENT_TAG := $(REGISTRY)/$(TRIDENT_IMAGE):$(TRIDENT_VERSION)
+TRIDENT_TAG := $(REGISTRY)/$(TRIDENT_IMAGE)-$(TRIDENT_VERSION):$(CUSTOM_IMAGE_TAG)
OPERATOR_TAG := $(REGISTRY)/$(OPERATOR_IMAGE):$(TRIDENT_VERSION)
TRIDENT_IMAGE_REPO := $(REGISTRY)/$(TRIDENT_IMAGE):
DEFAULT_OPERATOR_TAG := $(DEFAULT_REGISTRY)/$(OPERATOR_IMAGE):$(VERSION)

0 comments on commit ab84f8b

Please sign in to comment.