-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from bancorprotocol/46-add-new-github-action-f…
…or-automating-production-job-restart-upon-new-version-update 46 add new GitHub action for automating production job restart upon new version update
- Loading branch information
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Restart Databricks Jobs | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Bump Version, Generate Changelog, Create Release, and Publish"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
restart_jobs: | ||
runs-on: ubuntu-latest | ||
needs: combined_job | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Restart Databricks Jobs | ||
run: | | ||
echo "Getting list of jobs..." | ||
JOB_LIST=$(curl -X GET -H "Authorization: Bearer ${{ secrets.SERVER_TOKEN }}" "https://${{ secrets.SERVER_DOMAIN }}/api/2.0/jobs/list") | ||
echo "Jobs: $JOB_LIST" | ||
for JOB in $(echo "${JOB_LIST}" | jq -r '.jobs[].job_id'); do | ||
JOB_INFO=$(curl -X GET -H "Authorization: Bearer ${{ secrets.SERVER_TOKEN }}" "https://${{ secrets.SERVER_DOMAIN }}/api/2.0/jobs/get?job_id=$JOB") | ||
CLUSTER_NAME=$(echo "$JOB_INFO" | jq -r '.settings.new_cluster.cluster_name') | ||
if [ "$CLUSTER_NAME" = "Fastlane (v3)" ]; then | ||
echo "Restarting job $JOB on cluster $CLUSTER_NAME..." | ||
RESPONSE=$(curl -X POST -H "Authorization: Bearer ${{ secrets.SERVER_TOKEN }}" -d "{\"job_id\": $JOB}" "https://${{ secrets.SERVER_DOMAIN }}/api/2.0/jobs/run-now") | ||
echo "Response: $RESPONSE" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters