Skip to content

Commit

Permalink
Merge pull request #4 from ebarriosjr/add-stop-posibilitie
Browse files Browse the repository at this point in the history
Add stop possibilitie
  • Loading branch information
ebarriosjr authored Sep 5, 2023
2 parents a33ef1f + 25bd310 commit a257a42
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ then
NOMAD_PORT = "4646"
fi

if [ -z "$NOMAD_ACTION" ];
then
echo -e "NOMAD_ACTION variable not set.\nUsing default value: run"
NOMAD_ACTION = "run"
fi"
if ! command -v nomad &> /dev/null
then
echo -e "Installing nomad..."
Expand All @@ -30,8 +36,8 @@ then
echo -e "Installed:" $(nomad version)
fi
echo -e "NOMAD_ADDR:" $NOMAD_ADDR "\nNOMAD_PORT:" $NOMAD_PORT "\nNOMAD_JOB:" $NOMAD_JOB""
NOMAD_ADDR=${NOMAD_ADDR}:${NOMAD_PORT} nomad job run $VARS $GITHUB_WORKSPACE/$NOMAD_JOB
echo -e "NOMAD_ADDR:" $NOMAD_ADDR "\nNOMAD_PORT:" $NOMAD_PORT "\nNOMAD_JOB:" $NOMAD_JOB"\nNOMAD_ACTION:" $NOMAD_ACTION
NOMAD_ADDR=${NOMAD_ADDR}:${NOMAD_PORT} nomad job ${NOMAD_ACTION} $VARS $GITHUB_WORKSPACE/$NOMAD_JOB
RESULT="$?"
# check if job was rolled back
Expand All @@ -40,7 +46,7 @@ if [ "$RESULT" == "0" ]; then
RESULT="$?"
fi
# check result of nomad job run
# check result of nomad job $NOMAD_ACTION
if [ "$RESULT" == "1" ]; then
echo -e "nomad exit Code:" $RESULT "\n[ERROR] FAILED to deploy job"
exit 1
Expand Down

0 comments on commit a257a42

Please sign in to comment.