Skip to content

Commit

Permalink
Merge pull request opstree#32 from opstree/bpmaven
Browse files Browse the repository at this point in the history
adding generateoutput in bash.sh and installing jq in dockerfile
  • Loading branch information
sandy724 authored Jul 13, 2022
2 parents eb987c8 + 988f8ba commit 15486b1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
6 changes: 3 additions & 3 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM maven:3.3-jdk-8

RUN apt-get update || true
RUN apt-get install jq
COPY build.sh .
ENV ACTIVITY_SUB_TASK_CODE MVN_EXECUTE

ENTRYPOINT [ "./build.sh" ]
ENTRYPOINT [ "./build.sh" ]
36 changes: 30 additions & 6 deletions builder/build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
#!/bin/bash

#!/bin/bash

generateOutput() {
Task=$1
Status=$2
Message=$3
OUTPUT_DIR=/src/${EXECUTION_DIR}/${EXECUTION_TASK_ID}
mkdir -p ${OUTPUT_DIR}
echo "{ \"${Task}\": {\"status\": \"${Status}\", \"message\": \"${Message}\"}}" | jq . > ${OUTPUT_DIR}/summary.json
echo "{ \"status\": \"${Status}\", \"message\": \"${Message}\"}" | jq . > ${OUTPUT_DIR}/${Task}.json
}

echo "I'll build the code"
sleep $SLEEP_DURATION
sleep $SLEEP_DURATION

cd $CODEBASE_DIR
cd $CODEBASE_DIR
mvn $INSTRUCTION
echo "Code building done"
if [ $? -eq 0 ]
then
generateOutput mvn_execute true "dhek chal gya"
echo "build sucessfull"
elif [ $? != 0 ]
then
generateOutput mvn_execute false "nhi chala"
echo "build unsucessfull"
fi








OUTPUT_DIR=${EXECUTION_DIR}/${EXECUTION_TASK_ID}

echo '{"mvn_execute": {"status": true, "message": "Dekha chal gaya"}}' > ${OUTPUT_DIR}/summary.json

echo '{"status": true, "message": "Dekha chal gaya"}' > ${OUTPUT_DIR}/mvn_execute.output

0 comments on commit 15486b1

Please sign in to comment.