From 59de9f0dfac8cf9111fa91eca42aa27b4fcd818f Mon Sep 17 00:00:00 2001 From: LucasBassoOcto <120090362+LucasBassoOcto@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:36:25 +0100 Subject: [PATCH 1/2] fixing ci for starting vm --- .github/workflows/ovh-gpu-toggle.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ovh-gpu-toggle.yaml b/.github/workflows/ovh-gpu-toggle.yaml index 9572f9b..e4ddb3e 100644 --- a/.github/workflows/ovh-gpu-toggle.yaml +++ b/.github/workflows/ovh-gpu-toggle.yaml @@ -4,24 +4,26 @@ on: jobs: curl: - name: "Call to OVH" + name: "Call to OVH - start" runs-on: ubuntu-latest steps: - name: "Call API" id: api run: | HTTP_METHOD="POST" - HTTP_QUERY="https://api.ovh.com/1.0/cloud/project/${{ secrets.PROJECT_ID }}/instance/${{ secrets.INSTANCE_ID }}/stop" - TIME=$(curl -s https://api.ovh.com/1.0/auth/time) - CLEAR_SIGN=${{ secrets.OVH_APP_SECRET }}"+"${{ secrets.OVH_CONSUMER_KEY }}"+"$HTTP_METHOD"+"$HTTP_QUERY"+"$TIME + HTTP_QUERY="https://eu.api.ovh.com/1.0/cloud/project/${PROJECT_ID}/instance/${INSTANCE_ID}/start" + TIME=$(curl -s https://eu.api.ovh.com/1.0/auth/time) + HTTP_BODY="" + CLEAR_SIGN="$OVH_APP_SECRET+$OVH_CONSUMER_KEY+$HTTP_METHOD+$HTTP_QUERY+$HTTP_BODY+$TIME" SIG='$1$'$(echo -n $CLEAR_SIGN | openssl dgst -sha1 -hex | cut -f 2 -d ' ' ) - + curl -X $HTTP_METHOD \ $HTTP_QUERY \ - -H "Content-Type: application/json" \ - -H "X-Ovh-Application: ${{ secrets.OVH_APP_KEY }}" \ + -H "Content-Type:application/json;charset=utf-8" \ + -H "X-Ovh-Application: $OVH_APP_KEY" \ -H "X-Ovh-Timestamp: $TIME" \ -H "X-Ovh-Signature: $SIG" \ - -H "X-Ovh-Consumer: ${{ secrets.OVH_CONSUMER_KEY }}" + -H "X-Ovh-Consumer: $OVH_CONSUMER_KEY" \ + --data "$HTTP_BODY" - name: "Get response" run: echo ${{ steps.api.outputs.response }} From f6b235d6ea1b48d11c76b708314580181d509a8d Mon Sep 17 00:00:00 2001 From: LucasBassoOcto <120090362+LucasBassoOcto@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:43:55 +0100 Subject: [PATCH 2/2] fixup secrets name --- .github/workflows/ovh-gpu-toggle.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ovh-gpu-toggle.yaml b/.github/workflows/ovh-gpu-toggle.yaml index e4ddb3e..cba6cdc 100644 --- a/.github/workflows/ovh-gpu-toggle.yaml +++ b/.github/workflows/ovh-gpu-toggle.yaml @@ -10,6 +10,11 @@ jobs: - name: "Call API" id: api run: | + INSTANCE_ID=${{ secrets.INSTANCE_ID }} + PROJECT_ID=${{ secrets.PROJECT_ID }} + OVH_CONSUMER_KEY=${{ secrets.OVH_CONSUMER_KEY }} + OVH_APP_KEY=${{ secrets.OVH_APP_KEY }} + OVH_APP_SECRET=${{ secrets.OVH_APP_SECRET }} HTTP_METHOD="POST" HTTP_QUERY="https://eu.api.ovh.com/1.0/cloud/project/${PROJECT_ID}/instance/${INSTANCE_ID}/start" TIME=$(curl -s https://eu.api.ovh.com/1.0/auth/time)