forked from Elin24/cclabeler
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.42 KB
/
start-job-ovhai.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Start ovhai job container
on:
schedule:
- cron: '0 0 1 1 *'
env:
OVH_REGION: GRA
TAG: latest
jobs:
start:
runs-on: ubuntu-latest
steps:
- name: Install ovhai command
run: |
wget https://cli.${{ env.OVH_REGION }}.training.ai.cloud.ovh.net/ovhai-linux.zip
unzip ovhai-linux.zip
mkdir -p $HOME/bin
mv ovhai $HOME/bin/ovhai
echo "$PATH:$HOME/bin/" >> $GITHUB_PATH
- name: Login to ovhai
run: |
ovhai login -p ${{ secrets.OVH_PSWD }} -u ${{ secrets.OVH_USER }}
- name: Deploy to ovhai
id: deploy
run: |
ovhai job run --default-http-port 8000 --unsecure-http --cpu 4 --volume cclabeler-data@gra:/workspace/data:rw --label name=cclabeler -o json ghcr.io/datalab-mi/cclabeler:${{ env.TAG }} > job.json
echo "::set-output name=OVH_JOB_ID::$(cat job.json | jq -r '.id')"
- name: get url
run: echo https://${{ steps.deploy.outputs.OVH_JOB_ID }}.job.gra.training.ai.cloud.ovh.net
- name: persist job url
run: |
curl -X POST \
-H 'x-api-key: ${{ secrets.PERSISTENT_VALUE_ACCESS_TOKEN }}' \
-H 'x-github-repo: https://github.com/datalab-mi/cclabeler' \
-H 'content-type: application/json' \
-d '{ "value": "${{ steps.deploy.outputs.OVH_JOB_ID }}" }' \
'https://persistent.aaim.io/api/values/set?key=OVH_JOB_ID&output=plain'