Skip to content

Commit

Permalink
fix integration bump
Browse files Browse the repository at this point in the history
  • Loading branch information
orouz committed Feb 15, 2024
1 parent e83f460 commit 27a65e5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions scripts/bump_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -euo pipefail
export MANIFEST_PATH="packages/cloud_security_posture/manifest.yml"
export CHANGELOG_PATH="packages/cloud_security_posture/changelog.yml"
export INTEGRATION_REPO="elastic/integrations"
export BRANCH="bump-to-$NEXT_CLOUDBEAT_VERSION"
MAJOR_MINOR_CLOUDBEAT=$(echo "$NEXT_CLOUDBEAT_VERSION" | cut -d. -f1,2)
export BRANCH="bump-to-$CURRENT_CLOUDBEAT_VERSION"
MAJOR_MINOR_CLOUDBEAT=$(echo "$CURRENT_CLOUDBEAT_VERSION" | cut -d. -f1,2)

export MAJOR_MINOR_CLOUDBEAT

Expand All @@ -18,13 +18,13 @@ checkout_integration_repo() {
}

get_next_integration_version() {
current_version=$(yq '.[0].version' changelog.yml | tr -d '"')
current_version=$(yq '.[0].version' $CHANGELOG_PATH | tr -d '"')
preview_number="${current_version##*-preview}"
preview_number="${preview_number##*(0)}" # Remove leading zeros
preview_number="${preview_number##*(0)}"
((next_preview_number = preview_number + 1))
next_preview_number_formatted=$(printf "%02d" "$next_preview_number")
NEXT_INTEGRATION_VERSION="${current_version%-*}-preview${next_preview_number_formatted}"

echo "• Next integration version: $NEXT_INTEGRATION_VERSION"
export NEXT_INTEGRATION_VERSION
}

Expand All @@ -35,8 +35,8 @@ update_manifest_version_vars() {

# cis_aws + vuln_mgmt_aws
echo "• Update cloudformation-* in manifest.yml"
sed -i'' -E "s/cloudformation-cnvm-[0-9]+\.[0-9]+\.[0-9]+/cloudformation-cnvm-$NEXT_CLOUDBEAT_VERSION/g" $MANIFEST_PATH
sed -i'' -E "s/cloudformation-cspm-ACCOUNT_TYPE-[0-9]+\.[0-9]+\.[0-9]+/cloudformation-cspm-ACCOUNT_TYPE-$NEXT_CLOUDBEAT_VERSION/g" $MANIFEST_PATH
sed -i'' -E "s/cloudformation-cnvm-[0-9]+\.[0-9]+\.[0-9]+/cloudformation-cnvm-$CURRENT_CLOUDBEAT_VERSION/g" $MANIFEST_PATH
sed -i'' -E "s/cloudformation-cspm-ACCOUNT_TYPE-[0-9]+\.[0-9]+\.[0-9]+/cloudformation-cspm-ACCOUNT_TYPE-$CURRENT_CLOUDBEAT_VERSION/g" $MANIFEST_PATH

# cis_azure
echo "• Update cloudshell_git_branch in manifest.yml"
Expand All @@ -46,7 +46,6 @@ update_manifest_version_vars() {
git commit -m "Update manifest template vars"
git push origin "$BRANCH"
}

create_integrations_pr() {
cat <<EOF >pr_body
Bump integration version - \`$NEXT_INTEGRATION_VERSION\`
Expand Down Expand Up @@ -86,7 +85,7 @@ update_changelog_version() {

checkout_integration_repo
get_next_integration_version
update_manifest_version_vars
update_manifest_version
update_changelog_version
update_manifest_version_vars
create_integrations_pr
update_changelog_version

0 comments on commit 27a65e5

Please sign in to comment.