Skip to content

Commit

Permalink
feat: publish custom trident images to ghcr.io
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 24, 2024
1 parent 01e1319 commit e8abb85
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/trident.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:

jobs:
build:
# github.ref == 'refs/heads/main' &&
if: |
!github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest

defaults:
Expand All @@ -19,27 +23,31 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout trident repo
run: ./checkout.sh

- name: Patch Dockerfile with alpine and nfs-utils
working-directory: trident-distrowith/trident
run: patch Dockerfile ../dockerfile.patch

- name: Patch Makefile to change default registry for images
working-directory: trident-distrowith/trident
run: patch Makefile ../makefile.patch

- name: Run make command
working-directory: trident-distrowith/trident
env:
BUILD_TYPE: stable
run: make images

- name: Run docker images
run: docker images
- name: List docker images
run: docker image ls

- name: Log in to ghcr.io registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push docker images
run: |
docker image ls --format=json | \
jq 'select(.Repository == "ghcr.io/postfinance/trident") | .Repository + ":" + .Tag' | \
xargs -I_ docker push _
11 changes: 11 additions & 0 deletions trident-distrowith/makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Makefile.original 2024-10-24 20:45:15
+++ Makefile 2024-10-24 20:45:37
@@ -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

0 comments on commit e8abb85

Please sign in to comment.