Skip to content

Commit

Permalink
Bumps version to 0.3.0 (output job_id support) (#23)
Browse files Browse the repository at this point in the history
* Adds output job_id
* Adds CODEOWNERS
  • Loading branch information
eBsowka authored Oct 31, 2022
1 parent 3724c36 commit ed548ae
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# require 1 PR approval from delivery-admins if the files changed are within the .github folder
* @cgpu

4 changes: 3 additions & 1 deletion .github/workflows/cloudos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Print cloudos job run command (dry_run set to true)
uses: lifebit-ai/action-cloudos-cli@0.2.0
uses: lifebit-ai/action-cloudos-cli@0.3.0
id: cloudos_job_run
with:
apikey: ${{ secrets.CLOUDOS_APIKEY }}
Expand All @@ -24,5 +24,7 @@ jobs:
instance_disk: 40
wait_time: 7200
cost_limit: 0.1
- name: Get the cloudos_job_run job ID
run: echo ${{steps.cloudos_job_run.outputs.job_id}}


5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,8 @@ Request interval in seconds. The options is influencing the request interval for

Additional cloudos-cli flags, space separated eg `'--spot --resumable'`. Available options: `[--spot, --batch, --resumable, --verbose, --wait-completion]`

## Outputs

### `job_id`

Job ID extracted from Lifebit CloudOS cloudos-cli.
3 changes: 3 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ inputs:
description: 'Mode of execution for the action, by default the API call will be sent. Set to dry_run: true if you only want to print the command (strips secrets before printing).'
required: false
default: false
outputs:
job_id:
description: 'Job ID from Lifebit CloudOS cloudos-cli'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
13 changes: 11 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,14 @@ if [[ ${INPUT_REQUEST_INTERVAL} ]]; then CLOUDOS_RUN_CMD+=" --request-interva
if [[ ${INPUT_COST_LIMIT} ]]; then CLOUDOS_RUN_CMD+=" --cost-limit ${INPUT_COST_LIMIT}" ; fi
if [[ ${INPUT_CLOUDOS_CLI_FLAGS} ]]; then CLOUDOS_RUN_CMD+=" ${INPUT_CLOUDOS_CLI_FLAGS}" ; fi

if [[ ${INPUT_DRY_RUN} != 'true' ]]; then $CLOUDOS_RUN_CMD ; fi
printf '%s\n' "${CLOUDOS_RUN_CMD//$INPUT_APIKEY/}"
if [[ ${INPUT_DRY_RUN} != 'true' ]]
then
stdout=$($CLOUDOS_RUN_CMD)
echo $stdout

job_idWithSpace=$(awk -F"Your assigned job id is: |Please, wait until job completion or max wait time of 3600 seconds is reached." '{print $2}' <<< "$stdout")
job_id=$(echo $job_idWithSpace | tr -d '\r' | tr -d '\n')
else
job_id=""
fi
echo "::set-output name=job_id::$job_id"

0 comments on commit ed548ae

Please sign in to comment.