Skip to content

Commit

Permalink
diff checks
Browse files Browse the repository at this point in the history
  • Loading branch information
orouz committed Feb 15, 2024
1 parent 27a65e5 commit 022026b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 35 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Bump Cloudbeat version

on:
workflow_dispatch:
# workflow_dispatch:
pull_request:
branches:
- main

env:
GITHUB_TOKEN: ${{ secrets.CLOUDSEC_MACHINE_TOKEN }}
Expand Down
58 changes: 34 additions & 24 deletions scripts/bump_cloudbeat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ update_version_beat() {

create_cloudbeat_versions_pr_for_main() {
echo "• Create PR for cloudbeat next version"
git add .
git commit -m "Bump cloudbeat to $NEXT_CLOUDBEAT_VERSION"
git push origin "$NEXT_CLOUDBEAT_BRANCH"
# git add .
# git commit -m "Bump cloudbeat to $NEXT_CLOUDBEAT_VERSION"
# git push origin "$NEXT_CLOUDBEAT_BRANCH"

cat <<EOF >cloudbeat_pr_body
Bump cloudbeat version - \`$NEXT_CLOUDBEAT_VERSION\`
Expand All @@ -80,19 +80,23 @@ Bump cloudbeat version - \`$NEXT_CLOUDBEAT_VERSION\`
> This is an automated PR
EOF

gh pr create --title "Bump cloudbeat version" \
--body-file cloudbeat_pr_body \
--base "main" \
--head "$NEXT_CLOUDBEAT_BRANCH" \
--label "backport-skip"
# gh pr create --title "Bump cloudbeat version" \
# --body-file cloudbeat_pr_body \
# --base "main" \
# --head "$NEXT_CLOUDBEAT_BRANCH" \
# --label "backport-skip"

rm -rf cloudbeat_pr_body
echo "Status 1"
git diff
git checkout .
}

create_cloudbeat_versions_pr_for_release() {
echo "• Create PR for cloudbeat release version"
git add .
git commit -m "Release cloudbeat $CURRENT_CLOUDBEAT_VERSION"
git push origin "$RELEASE_CLOUDBEAT_BRANCH"
# git add .
# git commit -m "Release cloudbeat $CURRENT_CLOUDBEAT_VERSION"
# git push origin "$RELEASE_CLOUDBEAT_BRANCH"

cat <<EOF >cloudbeat_pr_body_release
Release cloudbeat version - \`$CURRENT_CLOUDBEAT_VERSION\`
Expand All @@ -101,13 +105,16 @@ Release cloudbeat version - \`$CURRENT_CLOUDBEAT_VERSION\`
> This is an automated PR
EOF

gh pr create --title "Release cloudbeat version" \
--body-file cloudbeat_pr_body_release \
--base "$CURRENT_MINOR_VERSION" \
--head "$RELEASE_CLOUDBEAT_BRANCH" \
--label "backport-skip"
# gh pr create --title "Release cloudbeat version" \
# --body-file cloudbeat_pr_body_release \
# --base "$CURRENT_MINOR_VERSION" \
# --head "$RELEASE_CLOUDBEAT_BRANCH" \
# --label "backport-skip"

rm -rf cloudbeat_pr_body_release
echo "Status 3"
git diff
git checkout .
}

# We need to bump hermit seperately because we need to wait for the snapshot build to be available
Expand All @@ -117,9 +124,9 @@ bump_hermit() {
git checkout -b "$BRANCH" origin/main

sed -i'' -E "s/\"CLOUDBEAT_VERSION\": .*/\"CLOUDBEAT_VERSION\": \"$CURRENT_CLOUDBEAT_VERSION\",/g" bin/hermit.hcl
git add bin/hermit.hcl
git commit -m "Bump cloudbeat to $CURRENT_CLOUDBEAT_VERSION"
git push origin "$BRANCH"
# git add bin/hermit.hcl
# git commit -m "Bump cloudbeat to $CURRENT_CLOUDBEAT_VERSION"
# git push origin "$BRANCH"

cat <<EOF >hermit_pr_body
Bump cloudbeat version - \`$CURRENT_CLOUDBEAT_VERSION\`
Expand All @@ -132,13 +139,16 @@ Bump cloudbeat version - \`$CURRENT_CLOUDBEAT_VERSION\`
EOF

echo "• Create a PR for cloudbeat hermit version"
gh pr create --title "Bump hermit cloudbeat version" \
--body-file hermit_pr_body \
--base "main" \
--head "$BRANCH" \
--label "backport-skip"
# gh pr create --title "Bump hermit cloudbeat version" \
# --body-file hermit_pr_body \
# --base "main" \
# --head "$BRANCH" \
# --label "backport-skip"

rm -rf hermit_pr_body
echo "Status 2"
git diff
git checkout .
}

upload_cloud_formation_templates() {
Expand Down
25 changes: 15 additions & 10 deletions scripts/bump_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ update_manifest_version_vars() {
echo "• Update cloudshell_git_branch in manifest.yml"
sed -i'' -E "s/cloudbeat%2F[0-9]+\.[0-9]+/cloudbeat%2F$MAJOR_MINOR_CLOUDBEAT/g" $MANIFEST_PATH

git add $MANIFEST_PATH
git commit -m "Update manifest template vars"
git push origin "$BRANCH"
# git add $MANIFEST_PATH
# git commit -m "Update manifest template vars"
# git push origin "$BRANCH"
}
create_integrations_pr() {
cat <<EOF >pr_body
Expand All @@ -68,24 +68,29 @@ EOF
update_manifest_version() {
echo "• Update manifest version"
yq -i ".version = \"$NEXT_INTEGRATION_VERSION\"" $MANIFEST_PATH
git add $MANIFEST_PATH
git commit -m "Update manifest version"
git push origin "$BRANCH"
# git add $MANIFEST_PATH
# git commit -m "Update manifest version"
# git push origin "$BRANCH"
}

update_changelog_version() {
PR_URL="foo"
export PR_URL
echo "• Update changelog version"
yq -i ".[0].version = \"$NEXT_INTEGRATION_VERSION\"" $CHANGELOG_PATH
# this line below requires single quotes and env(PR) to interpolate this env var
yq -i '.[0].changes += [{"description": "Bump version", "type": "enhancement", "link": env(PR_URL) }]' $CHANGELOG_PATH
git add $CHANGELOG_PATH
git commit -m "Update changelog version"
git push origin "$BRANCH"
# git add $CHANGELOG_PATH
# git commit -m "Update changelog version"
# git push origin "$BRANCH"
}

checkout_integration_repo
get_next_integration_version
update_manifest_version
update_manifest_version_vars
create_integrations_pr
# create_integrations_pr
update_changelog_version
echo "diff 1"
git diff
git checkout .

0 comments on commit 022026b

Please sign in to comment.