From de4ad67becdccf52702395e176a08d3db724af34 Mon Sep 17 00:00:00 2001 From: Stacky McStackface Date: Tue, 28 Jan 2025 07:11:44 +0000 Subject: [PATCH] chore: Generated commit to update templated files since the last template run up to stackabletech/operator-templating@20d91e7e0a9d25a0865c20303f2ef72d7728aef2 Reference-to: stackabletech/operator-templating@20d91e7 (set defaults to oci) --- .github/workflows/build.yml | 18 ++++++++++++++---- Makefile | 4 ++-- Tiltfile | 8 ++++---- default.nix | 2 +- nix/sources.json | 6 +++--- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99d2fe29..8a8a435a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -354,13 +354,18 @@ jobs: cargo set-version --offline --workspace "$PR_VERSION" - name: Update version if PR against non-main branch # For PRs to be merged against a release branch, use the version that has already been set in the calling script. - if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-') }} + # We can't rely on cargo set-version here as we will break semver rules when changing the version to make it + # specific to this PR e.g. 1.2.0 --> 1.2.0-pr678, so set it manually. + if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }} env: PR_NUMBER: ${{ github.event.pull_request.number }} + shell: bash run: | + set -euo pipefail + MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}" - cargo set-version --offline --workspace "$PR_VERSION" + sed -i "s/version = \"${MANIFEST_VERSION}\"/version = \"${PR_VERSION}\"/" Cargo.toml # Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the # default value in the makefile if called from this action, but not otherwise (i.e. when called locally). @@ -433,13 +438,18 @@ jobs: cargo set-version --offline --workspace "$PR_VERSION" - name: Update version if PR against non-main branch # For PRs to be merged against a release branch, use the version that has already been set in the calling script. - if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-') }} + # We can't rely on cargo set-version here as we will break semver rules when changing the version to make it + # specific to this PR e.g. 1.2.0 --> 1.2.0-pr678, so set it manually. + if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }} env: PR_NUMBER: ${{ github.event.pull_request.number }} + shell: bash run: | + set -euo pipefail + MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}" - cargo set-version --offline --workspace "$PR_VERSION" + sed -i "s/version = \"${MANIFEST_VERSION}\"/version = \"${PR_VERSION}\"/" Cargo.toml - name: Build manifest list run: | # Creating manifest list diff --git a/Makefile b/Makefile index 4daf6d1e..9fb762a0 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ docker-publish: # Attest the SBOM to the image\ cosign attest -y --predicate sbom.merged.json --type cyclonedx "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}@$$REPO_DIGEST_OF_IMAGE" -# This assumes "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}-amd64 and "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}-arm64 are build and pushed +# This assumes "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-amd64 and "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-arm64 are built and pushed docker-manifest-list-build: docker manifest create "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}" --amend "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}-amd64" --amend "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}-arm64" docker manifest create "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}" --amend "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-amd64" --amend "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-arm64" @@ -119,7 +119,7 @@ docker-manifest-list-publish: docker: docker-build docker-publish print-docker-tag: - @echo "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}" + @echo "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}" helm-publish: # Push to Nexus diff --git a/Tiltfile b/Tiltfile index 73c19bcf..fb84bcc0 100644 --- a/Tiltfile +++ b/Tiltfile @@ -1,8 +1,8 @@ # If tilt_options.json exists read it and load the default_registry value from it settings = read_json('tilt_options.json', default={}) -registry = settings.get('default_registry', 'docker.stackable.tech/sandbox') +registry = settings.get('default_registry', 'oci.stackable.tech/sandbox') -# Configure default registry either read from config file above, or with default value of "docker.stackable.tech/sandbox" +# Configure default registry either read from config file above, or with default value of "oci.stackable.tech/sandbox" default_registry(registry) meta = read_json('nix/meta.json') @@ -23,8 +23,8 @@ if os.path.exists('result'): k8s_yaml('result/crds.yaml') # We need to set the correct image annotation on the operator Deployment to use e.g. -# docker.stackable.tech/sandbox/opa-operator:7y19m3d8clwxlv34v5q2x4p7v536s00g instead of -# docker.stackable.tech/sandbox/opa-operator:0.0.0-dev (which does not exist) +# oci.stackable.tech/sandbox/opa-operator:7y19m3d8clwxlv34v5q2x4p7v536s00g instead of +# oci.stackable.tech/sandbox/opa-operator:0.0.0-dev (which does not exist) k8s_kind('Deployment', image_json_path='{.spec.template.metadata.annotations.internal\\.stackable\\.tech/image}') # Exclude stale CRDs from Helm chart, and apply the rest diff --git a/default.nix b/default.nix index 4932cb85..263d8193 100644 --- a/default.nix +++ b/default.nix @@ -40,7 +40,7 @@ }; } , meta ? pkgs.lib.importJSON ./nix/meta.json -, dockerName ? "docker.stackable.tech/sandbox/${meta.operator.name}" +, dockerName ? "oci.stackable.tech/sandbox/${meta.operator.name}" , dockerTag ? null }: rec { diff --git a/nix/sources.json b/nix/sources.json index a8bcfd61..9a26de8f 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -29,10 +29,10 @@ "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0fcb98acb6633445764dafe180e6833eb0f95208", - "sha256": "1prmbz0c686b7583s6mcnrm67ky5xsks5zdspvkcb1vs6qsm5jp2", + "rev": "aa6ae0afa6adeb5c202a168e51eda1d3da571117", + "sha256": "1kbg6limdl7f21vr36g7qlrimm8lxr97b6kvxkz91yfdffn942p9", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/0fcb98acb6633445764dafe180e6833eb0f95208.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/aa6ae0afa6adeb5c202a168e51eda1d3da571117.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } }