Skip to content

Commit

Permalink
ci: update core diff script (#3707)
Browse files Browse the repository at this point in the history
* ci: update core diff script

* ci: add github url

* ci: fix script
  • Loading branch information
krtk6160 authored Dec 15, 2023
1 parent 74444b2 commit 8f04a47
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ jobs:
- task: open-charts-pr
config:
platform: linux
image_resource: #@ release_task_image_config()
image_resource: #@ galoy_dev_image_config()
inputs:
- name: repo
- name: pipeline-tasks
Expand Down
47 changes: 42 additions & 5 deletions ci/tasks/open-charts-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,58 @@ export cron_digest=$(cat ./cron-edge-image/digest)
export migrate_digest=$(cat ./migrate-edge-image/digest)
export websocket_digest=$(cat ./websocket-edge-image/digest)
export api_keys_digest=$(cat ./api-keys-edge-image/digest)
export github_url=https://github.com/GaloyMoney/galoy

pushd charts-repo

ref=$(yq e '.galoy.images.app.git_ref' charts/galoy/values.yaml)
git checkout ${BRANCH}
old_ref=$(yq e '.galoy.images.app.git_ref' charts/galoy/values.yaml)

pushd ../repo
if [[ -z $(git config --global user.email) ]]; then
git config --global user.email "[email protected]"
fi
if [[ -z $(git config --global user.name) ]]; then
git config --global user.name "CI Bot"
fi

export GH_TOKEN="$(gh-token generate -b "${GH_APP_PRIVATE_KEY}" -i "${GH_APP_ID}" | jq -r '.token')"
gh auth setup-git
# switch to https to use the token
git remote set-url origin ${github_url}

git checkout ${old_ref}
app_src_files=($(buck2 uquery 'inputs(deps("//core/..."))' 2>/dev/null))

# create a branch with the old state of core
git checkout --orphan core-${old_ref}
git rm -rf . > /dev/null
for file in "${app_src_files[@]}"; do
git checkout "$old_ref" -- "$file"
done
git commit -m "Commit state of \`core\` at \`${old_ref}\`"
git push -fu origin core-${old_ref}

# create a branch from the old state
git branch core-${ref}
git checkout ${ref}
app_src_files=($(buck2 uquery 'inputs(deps("//core/..."))' 2>/dev/null))

# commit the new state of core
git checkout core-${ref}
for file in "${app_src_files[@]}"; do
git checkout "$ref" -- "$file"
done
git commit -m "Commit state of \`core\` at \`${ref}\`"
git push -fu origin core-${ref}

cat <<EOF >> ../body.md
# Bump galoy image
Code diff contained in this image:
https://github.com/GaloyMoney/galoy/compare/${old_ref}...${ref}
${github_url}/compare/core-${old_ref}...core-${ref}
The galoy api image will be bumped to digest:
\`\`\`
Expand Down Expand Up @@ -59,11 +98,9 @@ ${api_keys_digest}
\`\`\`
EOF

pushd ../repo
git cliff --config ../pipeline-tasks/ci/vendor/config/git-cliff.toml ${old_ref}..${ref} > ../charts-repo/release_notes.md
popd
git cliff --config ../pipeline-tasks/ci/vendor/config/git-cliff.toml ${old_ref}..${ref} > ../charts-repo/release_notes.md

export GH_TOKEN="$(ghtoken generate -b "${GH_APP_PRIVATE_KEY}" -i "${GH_APP_ID}" | jq -r '.token')"
popd

breaking=""
if [[ $(cat release_notes.md | grep breaking) != '' ]]; then
Expand Down

0 comments on commit 8f04a47

Please sign in to comment.