Skip to content

Commit d0098d5

Browse files
authored
Merge pull request #34 from netfoundry/fiddle-actions
fix build cache tag
2 parents bbd2075 + c0430c4 commit d0098d5

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.github/workflows/pr.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pr
1+
name: Pull Request - Regression Test
22
on:
33
pull_request:
44
types: [opened, synchronize]
@@ -41,8 +41,8 @@ jobs:
4141
uses: docker/build-push-action@v6
4242
with:
4343
platforms: linux/amd64,linux/arm64
44-
cache-from: type=registry,ref=${{ env.IMAGE_REPO }}
45-
cache-to: type=registry,ref=${{ env.IMAGE_REPO }}:build,mode=max
44+
cache-from: type=gha
45+
cache-to: type=gha,mode=max
4646
push: true
4747
tags: ${{ env.REGISTRY}}/${{ env.IMAGE_REPO }}:${{ github.run_id }}
4848

.github/workflows/pre-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobs:
5555
uses: docker/build-push-action@v6
5656
with:
5757
platforms: linux/amd64,linux/arm64
58-
cache-from: type=registry,ref=${{ env.IMAGE_REPO }}:build
59-
cache-to: type=registry,ref=${{ env.IMAGE_REPO }}:build,mode=max
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max
6060
labels: ${{ steps.meta.outputs.labels }}
6161
tags: ${{ steps.meta.outputs.tags }}
6262
build-args: VERSION=${{ github.ref_name }}

.github/workflows/promote.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: release
1+
name: Promote Stable Release
22

33
on:
44
release:
@@ -10,7 +10,7 @@ env:
1010
IMAGE_REPO: ${{ vars.ZITI_AGENT_IMAGE_REPO || 'netfoundry/ziti-k8s-agent' }}
1111

1212
jobs:
13-
build_deploy:
13+
promote:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Parse Release Version
@@ -50,11 +50,12 @@ jobs:
5050
type=raw,value=latest,enable=${{startsWith(github.ref_name, 'v')}}
5151
5252
# set (e.g., "v1") major version tag on releases
53-
type=match,pattern=v\d+\..*,group=1,enable=${{startsWith(github.ref_name, 'v')}}
53+
type=match,pattern=(v\d+)\..*,group=1,enable=${{startsWith(github.ref_name, 'v')}}
5454
5555
- name: Promote Container Image Tags
5656
shell: bash
5757
run: |
58+
set -o xtrace
5859
# Convert comma-separated tags to array
5960
IFS=',' read -ra TAGS <<< "${{ steps.meta.outputs.tags }}"
6061
@@ -65,6 +66,6 @@ jobs:
6566
for TAG in "${TAGS[@]}"; do
6667
echo "Creating tag for $TAG -> $VERSION"
6768
docker buildx imagetools create \
68-
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:${TAG} \
69+
--tag ${TAG} \
6970
${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}:${VERSION}
7071
done

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ WORKDIR /app
44

55
# Version can be passed as --build-arg VERSION=$(git describe --tags --always)
66
ARG VERSION=v0.0.0
7-
COPY . .
8-
RUN --mount=type=cache,target=/go/pkg/mod \
9-
--mount=type=cache,target=/root/.cache/go-build \
7+
8+
RUN go env -w GOMODCACHE=/root/.cache/go-build
9+
COPY go.mod go.sum ./
10+
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
11+
12+
COPY ./ziti-agent/ ./ziti-agent/
13+
RUN --mount=type=cache,target=/root/.cache/go-build \
1014
go build -x -v -ldflags="-X 'github.com/netfoundry/ziti-k8s-agent/ziti-agent/cmd/common.Version=${VERSION}'" -o build/ ./...
1115

1216
#

0 commit comments

Comments
 (0)