From 38e8d49071508c308511436b952cc253976e114c Mon Sep 17 00:00:00 2001 From: Zeort Date: Tue, 13 Aug 2024 11:28:57 +0300 Subject: [PATCH 1/3] add create-korifi-release script --- scripts/create-korifi-release.sh | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 scripts/create-korifi-release.sh diff --git a/scripts/create-korifi-release.sh b/scripts/create-korifi-release.sh new file mode 100644 index 0000000..b51a807 --- /dev/null +++ b/scripts/create-korifi-release.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -euo pipefail + +VERSION=${1:-} +RELEASE_DIR="./release-$VERSION" +GITSHA=$(git rev-parse --short HEAD) + +mkdir -p $RELEASE_DIR +cp ./CHANGELOG.md $RELEASE_DIR/ +cp ./scripts/assets/korifi-kbld.yml $RELEASE_DIR/ + +kbld \ + -f "$RELEASE_DIR/korifi-kbld.yml" \ + -f "./helm/korifi/values.yaml" \ + --images-annotation=false >$RELEASE_DIR/values.yaml + +API_SOURCE=`yq .api.image $RELEASE_DIR/values.yaml` +CONTR_SOURCE=`yq .controllers.image $RELEASE_DIR/values.yaml +` +API_TARGET="ghcr.io/kyma-project/cfapi/korifi-api" +CONTR_TARGET="ghcr.io/kyma-project/cfapi/korifi-controllers" + +echo "tag target API image $API_TARGET" +docker tag $API_SOURCE $API_TARGET:latest +docker tag $API_SOURCE $API_TARGET:$VERSION +docker tag $API_SOURCE $API_TARGET:$GITSHA +docker push --all-tags $API_TARGET + +echo "tag target CONTROLLERS image $API_TARGET" +docker tag $CONTR_SOURCE $CONTR_TARGET:latest +docker tag $CONTR_SOURCE $CONTR_TARGET:$VERSION +docker tag $CONTR_SOURCE $CONTR_TARGET:$GITSHA +docker push --all-tags $CONTR_TARGET + +export API_SHA_REF=$(docker inspect --format='{{index .RepoDigests 0}}' $API_TARGET) +export CONTR_SHA_REF=$(docker inspect --format='{{index .RepoDigests 0}}' $CONTR_TARGET) + +yq -i '.api.image = strenv(API_SHA_REF)' $RELEASE_DIR/values.yaml +yq -i '.controllers.image = strenv(CONTR_SHA_REF)' $RELEASE_DIR/values.yaml + + +tar -czf $RELEASE_DIR/korifi-helm.tar.gz -C helm korifi \ No newline at end of file From a055202701d025579a91003b03c634675b64e6c0 Mon Sep 17 00:00:00 2001 From: Zeort Date: Tue, 13 Aug 2024 11:37:33 +0300 Subject: [PATCH 2/3] add +x --- scripts/create-korifi-release.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/create-korifi-release.sh diff --git a/scripts/create-korifi-release.sh b/scripts/create-korifi-release.sh old mode 100644 new mode 100755 From 444344e67ff554c4e614abbd836546b7f747fd9d Mon Sep 17 00:00:00 2001 From: Zeort Date: Tue, 13 Aug 2024 11:55:48 +0300 Subject: [PATCH 3/3] create korifi release artifacts in workflow --- .github/workflows/build-korifi.yml | 11 +++++++++++ scripts/create-korifi-release.sh | 1 + 2 files changed, 12 insertions(+) diff --git a/.github/workflows/build-korifi.yml b/.github/workflows/build-korifi.yml index 7aebc36..6f7eae3 100644 --- a/.github/workflows/build-korifi.yml +++ b/.github/workflows/build-korifi.yml @@ -35,4 +35,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: create korifi release artifacts + env: + VERSION: ${{ env.V_KORIFI }} + DOCKER_REGISTRY: ${{ env.REGISTRY }} + DOCKER_REGISTRY_USER: ${{ github.actor }} + DOCKER_REGISTRY_PASS: ${{ secrets.GITHUB_TOKEN }} + shell: bash + working-directory: .github.tools.sap/unified-runtime/korifi-trinity/ + run: | + run: ./scripts/create-korifi-release.sh ${{ env.V_KORIFI }} + diff --git a/scripts/create-korifi-release.sh b/scripts/create-korifi-release.sh index b51a807..a5e1741 100755 --- a/scripts/create-korifi-release.sh +++ b/scripts/create-korifi-release.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -x set -euo pipefail VERSION=${1:-}