From 111e06c45caf225ee2d92bafdc9c224248b65c1f Mon Sep 17 00:00:00 2001 From: moelsayed Date: Fri, 7 Mar 2025 13:08:24 +0100 Subject: [PATCH 1/5] Add ocm-based publish action --- .github/workflows/publish.yaml | 90 ++++++++++++++++++++ charts/project-workspace-operator/Chart.yaml | 4 +- component-constructor.yaml | 19 +++++ settings.yaml | 4 + 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yaml create mode 100644 component-constructor.yaml create mode 100644 settings.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..4b9890e --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,90 @@ +name: publish +on: + push: + tags: + - v* + workflow_dispatch: + +permissions: + packages: write + +env: + OCI_URL: ghcr.io/openmcp-project + +jobs: + release_tag: + name: Release version + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ssh-key: ${{ secrets.PUSH_KEY }} + fetch-tags: true + fetch-depth: 0 + + - name: Read and validate VERSION + id: version + run: | + VERSION=$(cat VERSION) + if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev)?$ ]]; then + echo "Invalid version format in VERSION file: $VERSION" + exit 1 + fi + echo "New version: $VERSION" + echo "version=$VERSION" >> $GITHUB_ENV + + - name: Skip release if version is a dev version + if: contains(env.version, '-dev') + run: | + echo "Skipping development version release: ${{ env.version }}" + echo "SKIP=true" >> $GITHUB_ENV + exit 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Context for Buildx + id: buildx-context + run: | + docker context create builders + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + timeout-minutes: 5 + uses: docker/setup-buildx-action@v2 + with: + version: latest + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Build the ${{ github.repository }} + run: | + make prepare-release + make build + + - name: Build Images + run: | + IMAGE_REGISTRY=ghcr.io/openmcp-project make image-build + + - name: setup OCM + uses: open-component-model/ocm-setup-action@main + + - name: Create OCM CTF + run: | + ocm add componentversions --create \ + --file ctf component-constructor.yaml \ + --settings settings.yaml -- VERSION=${{ env.version }} + + - name: Push CTF + run: | + ocm transfer ctf ./ctf ${{ env.OCI_URL }} diff --git a/charts/project-workspace-operator/Chart.yaml b/charts/project-workspace-operator/Chart.yaml index a555f2f..f58cfb5 100644 --- a/charts/project-workspace-operator/Chart.yaml +++ b/charts/project-workspace-operator/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: btpflm-project-workspace-operator description: A Helm chart for the project-workspace-operator type: application -version: v0.9.0 -appVersion: v0.9.0 +version: v0.10.0 +appVersion: v0.10.0 diff --git a/component-constructor.yaml b/component-constructor.yaml new file mode 100644 index 0000000..09673f2 --- /dev/null +++ b/component-constructor.yaml @@ -0,0 +1,19 @@ +components: +- name: ${COMPONENT_NAME_PREFIX}/${COMPONENT_NAME} + version: ${VERSION} + provider: + name: ${PROVIDER} + resources: + - name: ${COMPONENT_NAME}-chart + type: helmChart + input: + type: helm + path: ./charts/${COMPONENT_NAME} + + - name: ${COMPONENT_NAME} + type: ociImage + input: + type: dockermulti + variants: + - "${COMPONENT_REPO_PREFIX}:${VERSION}-linux-amd64" + - "${COMPONENT_REPO_PREFIX}:${VERSION}-linux-arm64" diff --git a/settings.yaml b/settings.yaml new file mode 100644 index 0000000..cfaaa8f --- /dev/null +++ b/settings.yaml @@ -0,0 +1,4 @@ +COMPONENT_NAME: project-workspace-operator +COMPONENT_NAME_PREFIX: github.com/openmcp-project +PROVIDER: openmcp-project +COMPONENT_REPO_PREFIX: ghcr.io/openmcp-project/project-workspace-operator \ No newline at end of file From 0ff0b94b2a2f807944524dd4ba04a531899c6ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Sch=C3=BCnemann?= Date: Mon, 10 Mar 2025 10:42:42 +0100 Subject: [PATCH 2/5] set explicit path for image and chart --- component-constructor.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/component-constructor.yaml b/component-constructor.yaml index 09673f2..a00e629 100644 --- a/component-constructor.yaml +++ b/component-constructor.yaml @@ -9,11 +9,13 @@ components: input: type: helm path: ./charts/${COMPONENT_NAME} + repository: charts/${COMPONENT_NAME} - - name: ${COMPONENT_NAME} + - name: ${COMPONENT_NAME}-image type: ociImage input: type: dockermulti + repository: images/${COMPONENT_NAME} variants: - "${COMPONENT_REPO_PREFIX}:${VERSION}-linux-amd64" - "${COMPONENT_REPO_PREFIX}:${VERSION}-linux-arm64" From 4bd7c375ae91259665a1cc993a2aeb5fcee9617e Mon Sep 17 00:00:00 2001 From: moelsayed Date: Mon, 10 Mar 2025 11:34:53 +0100 Subject: [PATCH 3/5] add overwrite --- .github/workflows/publish.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 4b9890e..1a8ca71 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -4,6 +4,8 @@ on: tags: - v* workflow_dispatch: + pull_request: + permissions: packages: write @@ -87,4 +89,4 @@ jobs: - name: Push CTF run: | - ocm transfer ctf ./ctf ${{ env.OCI_URL }} + ocm transfer ctf --overwrite ./ctf ${{ env.OCI_URL }} From 1497add30e1d9ef57528542e7be93c09963a39e8 Mon Sep 17 00:00:00 2001 From: moelsayed Date: Mon, 10 Mar 2025 13:08:40 +0100 Subject: [PATCH 4/5] change base registery --- hack/common/get-registry.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/common/get-registry.sh b/hack/common/get-registry.sh index 4da3f9d..054aaf7 100755 --- a/hack/common/get-registry.sh +++ b/hack/common/get-registry.sh @@ -3,7 +3,8 @@ set -euo pipefail if [[ -z ${BASE_REGISTRY:-} ]]; then - BASE_REGISTRY=europe-docker.pkg.dev/sap-gcp-cp-k8s-stable-hub/openmcp + #FIXME: this is a place holder. + BASE_REGISTRY=ghcr.io/openmcp-project/ fi if [[ -z ${IMAGE_REGISTRY:-} ]]; then From 67da796383a451412087737c3b4fbf0e3be53db2 Mon Sep 17 00:00:00 2001 From: moelsayed Date: Mon, 10 Mar 2025 13:08:57 +0100 Subject: [PATCH 5/5] update chart --- charts/project-workspace-operator/Chart.yaml | 2 +- charts/project-workspace-operator/values.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/project-workspace-operator/Chart.yaml b/charts/project-workspace-operator/Chart.yaml index f58cfb5..dc59db5 100644 --- a/charts/project-workspace-operator/Chart.yaml +++ b/charts/project-workspace-operator/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: btpflm-project-workspace-operator +name: project-workspace-operator description: A Helm chart for the project-workspace-operator type: application version: v0.10.0 diff --git a/charts/project-workspace-operator/values.yaml b/charts/project-workspace-operator/values.yaml index 53fbba3..b6fda62 100644 --- a/charts/project-workspace-operator/values.yaml +++ b/charts/project-workspace-operator/values.yaml @@ -17,10 +17,10 @@ deployment: leaseNamespace: default image: - repository: deploy-releases-hyperspace-docker.common.repositories.cloud.sap/openmcp/project-workspace-operator + repository: ghcr.io/openmcp-project/github.com/openmcp-project/project-workspace-operator/images/project-workspace-operator pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: v0.9.0 + tag: v0.10.0 imagePullSecrets: [] nameOverride: ""