Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add previous channel release version check #27

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/checkPreviousChannelRelease.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

crane="/usr/local/bin/crane"
repositoryName=$1
edition=$2
channel=$3
version=$4

echo "Module $repositoryName, edition $edition, channel $channel, version $version"

if [[ "$channel" == "alpha" ]]; then
echo "Deploying $version to alpha channel"
exit 0
elif [[ "$channel" == "beta" ]]; then
previousChannel="alpha"
elif [[ "$channel" == "early-access" ]]; then
previousChannel="beta"
elif [[ "$channel" == "stable" ]]; then
previousChannel="early-access"
elif [[ "$channel" == "rock-solid" ]]; then
previousChannel="stable"
else
echo "Unknown channel"
exit 1
fi

echo "Checking previous channel $previousChannel"
previousChannelVersion=$($crane export registry.deckhouse.io/deckhouse/$edition/modules/$repositoryName/release:$previousChannel | grep -aoE '\{"version":".*"\}' | jq -r .version)
if [[ "$version" == "$previousChannelVersion" ]]; then
echo "Previous channel $previousChannel version $previousChannelVersion is equal desired version $version, processing"
exit 0
else
echo "Previous channel $previousChannel version $previousChannelVersion is not equal desired version $version, rejecting"
exit 1
fi
9 changes: 9 additions & 0 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
- name: Check previous release
run: |
.github/checkPreviousChannelRelease.sh $MODULE_SOURCE_NAME ce $RELEASE_CHANNEL $MODULES_MODULE_TAG
- uses: actions/checkout@v4
- uses: deckhouse/modules-actions/setup@v1
- uses: deckhouse/modules-actions/deploy@v1
Expand All @@ -82,6 +85,9 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
- name: Check previous release
run: |
.github/checkPreviousChannelRelease.sh $MODULE_SOURCE_NAME ee $RELEASE_CHANNEL $MODULES_MODULE_TAG
- uses: actions/checkout@v4
- uses: deckhouse/modules-actions/setup@v1
- uses: deckhouse/modules-actions/deploy@v1
Expand All @@ -98,6 +104,9 @@ jobs:
- name: ECHO VAR
run: |
echo $MODULES_MODULE_SOURCE
- name: Check previous release
run: |
.github/checkPreviousChannelRelease.sh $MODULE_SOURCE_NAME fe $RELEASE_CHANNEL $MODULES_MODULE_TAG
- uses: actions/checkout@v4
- uses: deckhouse/modules-actions/setup@v1
- uses: deckhouse/modules-actions/deploy@v1