From f5e37b66cf3460ea5d509fb0472354a257343e19 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Sun, 14 Sep 2025 17:36:01 +0300 Subject: [PATCH] Deploy using HURL So that the deployment can be monitored --- .github/workflows/test_and_deploy.yml | 10 +++++++--- mise.toml | 6 +++--- scripts/deploy.hurl | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 scripts/deploy.hurl diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index edb96c95..7431744e 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -81,6 +81,10 @@ jobs: if: github.ref == 'refs/heads/main' concurrency: deploy-group steps: - - name: Notify Coolify - run: | - curl --request GET '${{ secrets.COOLIFY_WEBHOOK }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' + - uses: actions/checkout@v4 + - uses: gacts/install-hurl@v1 + - run: hurl --test --progress-bar scripts/deploy.hurl + env: + HURL_coolify_token: ${{ secrets.COOLIFY_TOKEN }} + HURL_coolify_host: ${{ vars.COOLIFY_HOST }} + HURL_coolify_app_uuid: ${{ vars.COOLIFY_APP_UUID }} diff --git a/mise.toml b/mise.toml index 7024c65e..b92e85e4 100644 --- a/mise.toml +++ b/mise.toml @@ -168,10 +168,10 @@ run = 'rm data/music_library_prod*' description = 'Run HTTP tests against production' run = 'hurl --test test/prod.hurl' -[tasks."prod:trigger-deploy"] -description = 'Trigger a deploy on production infra' +[tasks."prod:deploy"] +description = 'Deploy on production and monitor' run = """ -curl --request GET "$COOLIFY_WEBHOOK" --header "Authorization: Bearer $COOLIFY_TOKEN" +hurl --test --progress-bar scripts/deploy.hurl """ # GIT TOOLING diff --git a/scripts/deploy.hurl b/scripts/deploy.hurl new file mode 100644 index 00000000..11afaba6 --- /dev/null +++ b/scripts/deploy.hurl @@ -0,0 +1,21 @@ +# Trigger a deploy and capture the deployment ID + +GET {{coolify_host}}/api/v1/deploy +Authorization: Bearer {{coolify_token}} +[Query] +uuid: {{coolify_app_uuid}} +HTTP 200 +[Captures] +deployment_uuid: jsonpath "$.deployments[0].deployment_uuid" + +# Watch the deployment until it's finished + +GET {{coolify_host}}/api/v1/deployments/{{deployment_uuid}} +Authorization: Bearer {{coolify_token}} +[Options] +delay: 20s +retry: 20 +retry-interval: 10s +HTTP 200 +[Asserts] +jsonpath "$.status" == "finished"