Skip to content

Commit

Permalink
Add previous channel release version check (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
Co-authored-by: Aleksandr Zimin <alexandr.zimin@flant.com>
  • Loading branch information
duckhawk and AleksZimin authored Apr 12, 2024
1 parent de4cf45 commit 4030326
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
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

0 comments on commit 4030326

Please sign in to comment.