From 0146a0bfbac04f372f713ca492d7df888ae7f506 Mon Sep 17 00:00:00 2001 From: Vegard Engen Date: Fri, 27 Jun 2025 00:38:20 +0200 Subject: [PATCH 1/4] Correct manifests with correct image --- .gitea/workflows/publish.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index 3e994cc..d2b1f5e 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -49,12 +49,13 @@ jobs: --bare - name: Build manifest run: | - make build-installer + IMB="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" make build-installer curl -X PUT \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/x-yaml" \ --data-binary @./dist/install.yaml \ https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml + IMB="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:$TAG" make build-installer curl -X PUT \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/x-yaml" \ -- 2.49.1 From 7d52648e2e54140981003ddc198f6434d7339bde Mon Sep 17 00:00:00 2001 From: Vegard Engen Date: Fri, 27 Jun 2025 00:50:10 +0200 Subject: [PATCH 2/4] Fix workflow --- .gitea/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index d2b1f5e..d66c98e 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -49,13 +49,13 @@ jobs: --bare - name: Build manifest run: | - IMB="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" make build-installer + make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" build-installer curl -X PUT \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/x-yaml" \ --data-binary @./dist/install.yaml \ https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml - IMB="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:$TAG" make build-installer + make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:$TAG" build-installer curl -X PUT \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/x-yaml" \ -- 2.49.1 From f406d470c1a5cdb3b2e2980ba9d8b0179440c70e Mon Sep 17 00:00:00 2001 From: Vegard Engen Date: Fri, 27 Jun 2025 01:05:16 +0200 Subject: [PATCH 3/4] Delete before put latest manifest --- .gitea/workflows/publish.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index d66c98e..f218988 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -50,6 +50,10 @@ jobs: - name: Build manifest run: | make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" build-installer + curl -X DELETE \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/x-yaml" \ + https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml curl -X PUT \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/x-yaml" \ -- 2.49.1 From 13cb024c6dce9d55daec4aa669d9203b57b7c23b Mon Sep 17 00:00:00 2001 From: Vegard Engen Date: Fri, 27 Jun 2025 01:13:55 +0200 Subject: [PATCH 4/4] Build tag only on tag, build latest on merge to main --- .gitea/workflows/kobuild.yaml | 29 +++++++++++++++++++++++++---- .gitea/workflows/publish.yaml | 12 +----------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/kobuild.yaml b/.gitea/workflows/kobuild.yaml index 19eb0e0..572ef07 100644 --- a/.gitea/workflows/kobuild.yaml +++ b/.gitea/workflows/kobuild.yaml @@ -22,7 +22,28 @@ jobs: run: git config --global url.git@gitea-ssh.engen.priv.no:.insteadOf https://gitea.engen.priv.no/ - name: Install ko run: go install github.com/google/ko@latest - - name: Build - run: KO_DOCKER_REPO=gitea.engen.priv.no/unifi-network-operator-controller PATH=~/go/bin:$PATH ko build --local ./cmd - - name: Build manifest - run: make build-installer + - name: Docker login + run: echo "${GITEA_TOKEN}" | docker login "${GITEA_REGISTRY}" --username "${GITEA_USER}" --password-stdin + - name: Build + run: | + export KO_DOCKER_REPO="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller" + ko publish ./cmd \ + --tags "latest" \ + --image-label 'org.opencontainers.image.authors=Klauvsteinen ' \ + --image-label 'org.opencontainers.image.vendor=Klauvsteinen' \ + --image-label 'org.opencontainers.image.source=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \ + --image-label 'org.opencontainers.image.url=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \ + --image-label 'dev.chainguard.package.main=' \ + --bare + - name: Build manifest + run: | + make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" build-installer + curl -X DELETE \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/x-yaml" \ + https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml + curl -X PUT \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/x-yaml" \ + --data-binary @./dist/install.yaml \ + https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index f218988..351b702 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -40,7 +40,7 @@ jobs: run: | export KO_DOCKER_REPO="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller" ko publish ./cmd \ - --tags "$TAG,latest" \ + --tags "$TAG" \ --image-label 'org.opencontainers.image.authors=Klauvsteinen ' \ --image-label 'org.opencontainers.image.vendor=Klauvsteinen' \ --image-label 'org.opencontainers.image.source=https://gitea.engen.priv.no/klauvsteinen/unifi-network-operator' \ @@ -49,16 +49,6 @@ jobs: --bare - name: Build manifest run: | - make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:latest" build-installer - curl -X DELETE \ - -H "Authorization: token $GITEA_TOKEN" \ - -H "Content-Type: application/x-yaml" \ - https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml - curl -X PUT \ - -H "Authorization: token $GITEA_TOKEN" \ - -H "Content-Type: application/x-yaml" \ - --data-binary @./dist/install.yaml \ - https://gitea.engen.priv.no/api/packages/klauvsteinen/generic/unifi-network-operator/latest/install.yaml make IMG="${GITEA_REGISTRY}/${GITEA_ORG}/unifi-network-operator-controller:$TAG" build-installer curl -X PUT \ -H "Authorization: token $GITEA_TOKEN" \ -- 2.49.1