-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
48 lines (40 loc) · 2.75 KB
/
entrypoint.sh
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
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
CLOUDOS_RUN_CMD="cloudos job run"
CLOUDOS_RUN_CMD+=" --apikey ${INPUT_APIKEY}"
CLOUDOS_RUN_CMD+=" --cloudos-url ${INPUT_CLOUDOS_URL}"
CLOUDOS_RUN_CMD+=" --workspace-id ${INPUT_WORKSPACE_ID}"
CLOUDOS_RUN_CMD+=" --project-name ${INPUT_PROJECT_NAME}"
CLOUDOS_RUN_CMD+=" --workflow-name ${INPUT_WORKFLOW_NAME}"
if [[ ${INPUT_JOB_CONFIG} ]]; then CLOUDOS_RUN_CMD+=" --job-config ${INPUT_JOB_CONFIG}" ; fi
if [[ ${INPUT_NEXTFLOW_PROFILE} ]]; then CLOUDOS_RUN_CMD+=" --nextflow-profile ${INPUT_NEXTFLOW_PROFILE}" ; fi
if [[ ${INPUT_GIT_COMMIT} ]]; then CLOUDOS_RUN_CMD+=" --git-commit ${INPUT_GIT_COMMIT}" ; fi
if [[ ${INPUT_GIT_TAG} ]]; then CLOUDOS_RUN_CMD+=" --git-tag ${INPUT_GIT_TAG}" ; fi
if [[ ${INPUT_JOB_NAME} ]]; then CLOUDOS_RUN_CMD+=" --job-name ${INPUT_JOB_NAME}" ; fi
if [[ ${INPUT_EXECUTION_PLATFORM} ]]; then CLOUDOS_RUN_CMD+=" --execution-platform ${EXECUTION_PLATFORM}" ; fi
if [[ ${INPUT_INSTANCE_TYPE} ]]; then CLOUDOS_RUN_CMD+=" --instance-type ${INPUT_INSTANCE_TYPE}" ; fi
if [[ ${INPUT_INSTANCE_DISK} ]]; then CLOUDOS_RUN_CMD+=" --instance-disk ${INPUT_INSTANCE_DISK}" ; fi
if [[ ${INPUT_STORAGE_MODE} ]]; then CLOUDOS_RUN_CMD+=" --storage-mode ${INPUT_STORAGE_MODE}" ; fi
if [[ ${INPUT_LUSTRE_SIZE} ]]; then CLOUDOS_RUN_CMD+=" --lustre-size ${INPUT_LUSTRE_SIZE}" ; fi
if [[ ${INPUT_WAIT_TIME} ]]; then CLOUDOS_RUN_CMD+=" --wait-time ${INPUT_WAIT_TIME}" ; fi
if [[ ${INPUT_WDL_MAINFILE} ]]; then CLOUDOS_RUN_CMD+=" --wdl-mainfile ${INPUT_WDL_MAINFILE}" ; fi
if [[ ${INPUT_WDL_IMPORTSFILE} ]]; then CLOUDOS_RUN_CMD+=" --wdl-importsfile ${INPUT_WDL_IMPORTSFILE}" ; fi
if [[ ${INPUT_CROMWELL_TOKEN} ]]; then CLOUDOS_RUN_CMD+=" --cromwell-token ${INPUT_CROMWELL_TOKEN}" ; fi
if [[ ${INPUT_REPOSITORY_PLATFORM} ]]; then CLOUDOS_RUN_CMD+=" --repository-platform ${INPUT_REPOSITORY_PLATFORM}" ; fi
if [[ ${INPUT_REQUEST_INTERVAL} ]]; then CLOUDOS_RUN_CMD+=" --request-interval ${INPUT_REQUEST_INTERVAL}" ; fi
if [[ ${INPUT_JOB_QUEUE} ]]; then CLOUDOS_RUN_CMD+=" --job-queue ${INPUT_JOB_QUEUE}" ; fi
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
echo "Command: "
printf '%s\n' "${CLOUDOS_RUN_CMD//$INPUT_APIKEY/}"
if [[ ${INPUT_DRY_RUN} != 'true' ]]
then
stdout=$($CLOUDOS_RUN_CMD)
echo "Result: "
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"