Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Edited workflows name and adding stop workflow (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasBassoOcto authored Jan 5, 2024
1 parent 9ded4e6 commit bc3b3f1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Activate OVH GPU Machine
name: Start OVH GPU Machine
on:
workflow_dispatch:

Expand All @@ -7,7 +7,7 @@ jobs:
name: "Call to OVH - start"
runs-on: ubuntu-latest
steps:
- name: "Call API"
- name: "Call API - start"
id: api
run: |
INSTANCE_ID=${{ secrets.INSTANCE_ID }}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ovh-gpu-stop-vm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Stop OVH GPU Machine
on:
workflow_dispatch:

jobs:
curl:
name: "Call to OVH - stop"
runs-on: ubuntu-latest
steps:
- name: "Call API - stop"
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}/stop"
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;charset=utf-8" \
-H "X-Ovh-Application: $OVH_APP_KEY" \
-H "X-Ovh-Timestamp: $TIME" \
-H "X-Ovh-Signature: $SIG" \
-H "X-Ovh-Consumer: $OVH_CONSUMER_KEY" \
--data "$HTTP_BODY"
- name: "Get response"
run: echo ${{ steps.api.outputs.response }}

0 comments on commit bc3b3f1

Please sign in to comment.