From d0d36f53d09844c096e99642639b469cf6b75bce Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 27 Oct 2022 14:38:16 +0530 Subject: [PATCH 01/12] Initial commit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4940938..c4b84ed 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# BP-PACKER_STEP \ No newline at end of file +# BP-PACKER_STEP +I'll provide the capability to manage the lifecycle of packer code \ No newline at end of file From 56a509f986b1e1a4f2201c745a3c6e76ea9ed87c Mon Sep 17 00:00:00 2001 From: neha Date: Thu, 27 Oct 2022 16:40:31 +0530 Subject: [PATCH 02/12] adding dockerfile for packer step --- .gitmodules | 3 +++ BP-BASE-SHELL-STEPS | 1 + Dockerfile | 13 +++++++++++++ build.sh | 25 +++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 .gitmodules create mode 160000 BP-BASE-SHELL-STEPS create mode 100644 Dockerfile create mode 100755 build.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9b7f929 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "BP-BASE-SHELL-STEPS"] + path = BP-BASE-SHELL-STEPS + url = https://github.com/OT-BUILDPIPER-MARKETPLACE/BP-BASE-SHELL-STEPS.git diff --git a/BP-BASE-SHELL-STEPS b/BP-BASE-SHELL-STEPS new file mode 160000 index 0000000..d183c87 --- /dev/null +++ b/BP-BASE-SHELL-STEPS @@ -0,0 +1 @@ +Subproject commit d183c87d5c4e99d7d672e6e499f2d8256d9729bd diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..813ed9a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM hashicorp/packer + +RUN apk add --no-cache --upgrade bash +RUN apk add jq + +ENV SLEEP_DURATION 5s + +COPY build.sh . +COPY BP-BASE-SHELL-STEPS/functions.sh . +ENV INSTRUCTION build +ENV ACTIVITY_SUB_TASK_CODE PACKER_PLUGIN_PATH EXTRA_VARS + +ENTRYPOINT [ "./build.sh" ]l \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d84efd9 --- /dev/null +++ b/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +source functions.sh + +echo "Manage the packer code available at [$WORKSPACE] and have mounted at [$CODEBASE_DIR]" +sleep $SLEEP_DURATION + + +cd ${WORKSPACE}/${CODEBASE_DIR} +logInfoMessage "packer ${INSTRUCTION}" + +packer ${INSTRUCTION} ${EXTRA_VARS} + +if [ $? -eq 0 ] +then + logInfoMessage "Congratulations packer build succeeded!!!" + generateOutput ${ACTIVITY_SUB_TASK_CODE} build true "Congratulations ami created sucessfully " +elif [ "${VALIDATION_FAILURE_ACTION}" == "FAILURE" ] + then + logErrorMessage "Please check packer build failed!!!" + generateOutput ${ACTIVITY_SUB_TASK_CODE} false "Please check packer build failed!!!" + exit 1 + else + logWarningMessage "Please check packer build failed!!!" + generateOutput ${ACTIVITY_SUB_TASK_CODE} true "Please check packer build failed!!!" +fi \ No newline at end of file From 208f72c67ab0fc554155ef70cb01d1dc1828c45f Mon Sep 17 00:00:00 2001 From: neha-sinha20 <102357600+neha-sinha20@users.noreply.github.com> Date: Thu, 27 Oct 2022 16:43:38 +0530 Subject: [PATCH 03/12] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 813ed9a..92d197f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,4 @@ COPY BP-BASE-SHELL-STEPS/functions.sh . ENV INSTRUCTION build ENV ACTIVITY_SUB_TASK_CODE PACKER_PLUGIN_PATH EXTRA_VARS -ENTRYPOINT [ "./build.sh" ]l \ No newline at end of file +ENTRYPOINT [ "./build.sh" ] From 7e28191deb2b259d8973c9c44f9058f65292c7de Mon Sep 17 00:00:00 2001 From: Sandeep Date: Fri, 28 Oct 2022 15:22:42 +0530 Subject: [PATCH 04/12] Added capability to have packer directory --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index d84efd9..d8763fc 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,11 @@ #!/bin/bash source functions.sh -echo "Manage the packer code available at [$WORKSPACE] and have mounted at [$CODEBASE_DIR]" +echo "Manage the packer code available at [$WORKSPACE] and have mounted at [${CODEBASE_DIR}/${PACKER_DIR}]" sleep $SLEEP_DURATION -cd ${WORKSPACE}/${CODEBASE_DIR} +cd ${WORKSPACE}/${CODEBASE_DIR}/${PACKER_DIR} logInfoMessage "packer ${INSTRUCTION}" packer ${INSTRUCTION} ${EXTRA_VARS} From e084f58e97bd5bd0002bccc36461eafe07fc9762 Mon Sep 17 00:00:00 2001 From: priyanshi chauhan Date: Wed, 13 Sep 2023 22:17:28 +0530 Subject: [PATCH 05/12] update Dockerfile and build.sh --- BP-BASE-SHELL-STEPS | 2 +- Dockerfile | 4 +++- build.sh | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/BP-BASE-SHELL-STEPS b/BP-BASE-SHELL-STEPS index d183c87..2fc5616 160000 --- a/BP-BASE-SHELL-STEPS +++ b/BP-BASE-SHELL-STEPS @@ -1 +1 @@ -Subproject commit d183c87d5c4e99d7d672e6e499f2d8256d9729bd +Subproject commit 2fc5616e1caaee927d87f97d6fa26c22d1b6ddca diff --git a/Dockerfile b/Dockerfile index 92d197f..0bc2de4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,10 @@ RUN apk add jq ENV SLEEP_DURATION 5s COPY build.sh . -COPY BP-BASE-SHELL-STEPS/functions.sh . +COPY BP-BASE-SHELL-STEPS . ENV INSTRUCTION build +ENV PACKER_DIR "" +ENV EXTRA_VARS "" ENV ACTIVITY_SUB_TASK_CODE PACKER_PLUGIN_PATH EXTRA_VARS ENTRYPOINT [ "./build.sh" ] diff --git a/build.sh b/build.sh index d8763fc..b50ea08 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,10 @@ #!/bin/bash -source functions.sh + +source functions.sh +source log-functions.sh +source str-functions.sh +source file-functions.sh +source aws-functions.sh echo "Manage the packer code available at [$WORKSPACE] and have mounted at [${CODEBASE_DIR}/${PACKER_DIR}]" sleep $SLEEP_DURATION From 042d88439783ae2f272efe16cb9db66dd6ae4a1a Mon Sep 17 00:00:00 2001 From: aakashopstree Date: Mon, 2 Dec 2024 13:43:41 +0530 Subject: [PATCH 06/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c4b84ed..319fd81 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # BP-PACKER_STEP -I'll provide the capability to manage the lifecycle of packer code \ No newline at end of file +I'll provide the capability to manage the lifecycle of packer code. From 3f9c0b4a72805e2f8ad95079ac6be2f97eeed19f Mon Sep 17 00:00:00 2001 From: Aakash Tripathi Date: Mon, 2 Dec 2024 15:03:56 +0530 Subject: [PATCH 07/12] Updating build.sh and Dockerfile --- Dockerfile | 2 +- build.sh | 28 +++++++++------------------- 2 files changed, 10 insertions(+), 20 deletions(-) mode change 100755 => 100644 build.sh diff --git a/Dockerfile b/Dockerfile index 0bc2de4..59f9862 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apk add jq ENV SLEEP_DURATION 5s COPY build.sh . -COPY BP-BASE-SHELL-STEPS . +ADD BP-BASE-SHELL-STEPS /opt/buildpiper/shell-functions/ ENV INSTRUCTION build ENV PACKER_DIR "" ENV EXTRA_VARS "" diff --git a/build.sh b/build.sh old mode 100755 new mode 100644 index b50ea08..acba686 --- a/build.sh +++ b/build.sh @@ -1,12 +1,12 @@ #!/bin/bash -source functions.sh -source log-functions.sh -source str-functions.sh -source file-functions.sh -source aws-functions.sh +source /opt/buildpiper/shell-functions/functions.sh +source /opt/buildpiper/shell-functions/log-functions.sh +source /opt/buildpiper/shell-functions/str-functions.sh +source /opt/buildpiper/shell-functions/file-functions.sh +source /opt/buildpiper/shell-functions/aws-functions.sh -echo "Manage the packer code available at [$WORKSPACE] and have mounted at [${CODEBASE_DIR}/${PACKER_DIR}]" +logInfoMessage "Manage the packer code available at [$WORKSPACE] and have mounted at [${CODEBASE_DIR}/${PACKER_DIR}]" sleep $SLEEP_DURATION @@ -15,16 +15,6 @@ logInfoMessage "packer ${INSTRUCTION}" packer ${INSTRUCTION} ${EXTRA_VARS} -if [ $? -eq 0 ] -then - logInfoMessage "Congratulations packer build succeeded!!!" - generateOutput ${ACTIVITY_SUB_TASK_CODE} build true "Congratulations ami created sucessfully " -elif [ "${VALIDATION_FAILURE_ACTION}" == "FAILURE" ] - then - logErrorMessage "Please check packer build failed!!!" - generateOutput ${ACTIVITY_SUB_TASK_CODE} false "Please check packer build failed!!!" - exit 1 - else - logWarningMessage "Please check packer build failed!!!" - generateOutput ${ACTIVITY_SUB_TASK_CODE} true "Please check packer build failed!!!" -fi \ No newline at end of file +TASK_STATUS=$? + +saveTaskStatus ${TASK_STATUS} ${ACTIVITY_SUB_TASK_CODE} From f521386caf29566c866f8e8881feea8ef8b46662 Mon Sep 17 00:00:00 2001 From: aakashopstree Date: Mon, 2 Dec 2024 15:08:59 +0530 Subject: [PATCH 08/12] Update README.md --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 319fd81..1dd17d3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ -# BP-PACKER_STEP +# BP-PACKER-STEP + I'll provide the capability to manage the lifecycle of packer code. + + +## Setup +* Clone the code available at [BP-PACKER-STEP](https://github.com/OT-BUILDPIPER-MARKETPLACE/BP-PACKER-STEP) +* Build the docker image + +``` +git submodule init +git submodule update +docker build -t registry.buildpiper.in/sonar-scan:0.1 . +``` From 636edb33c7dc320bb72bf5ae0eb458e01b447593 Mon Sep 17 00:00:00 2001 From: aakashopstree Date: Mon, 2 Dec 2024 15:16:48 +0530 Subject: [PATCH 09/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1dd17d3..abae8bd 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,5 @@ I'll provide the capability to manage the lifecycle of packer code. ``` git submodule init git submodule update -docker build -t registry.buildpiper.in/sonar-scan:0.1 . +docker build -t registry.buildpiper.in/packer-step:0.1 . ``` From 452b91a6cfd9c1ccb5b32a13943fbd7ebd910b41 Mon Sep 17 00:00:00 2001 From: aakashopstree Date: Mon, 2 Dec 2024 19:30:54 +0530 Subject: [PATCH 10/12] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 59f9862..dc554f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,6 @@ ADD BP-BASE-SHELL-STEPS /opt/buildpiper/shell-functions/ ENV INSTRUCTION build ENV PACKER_DIR "" ENV EXTRA_VARS "" -ENV ACTIVITY_SUB_TASK_CODE PACKER_PLUGIN_PATH EXTRA_VARS +ENV ACTIVITY_SUB_TASK_CODE PACKER_STEP ENTRYPOINT [ "./build.sh" ] From d11cd7279b35cd5c61c397b295f767183adf9dea Mon Sep 17 00:00:00 2001 From: Aakash Tripathi Date: Mon, 2 Dec 2024 19:44:56 +0530 Subject: [PATCH 11/12] Updating build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index acba686..22cba46 100644 --- a/build.sh +++ b/build.sh @@ -12,7 +12,7 @@ sleep $SLEEP_DURATION cd ${WORKSPACE}/${CODEBASE_DIR}/${PACKER_DIR} logInfoMessage "packer ${INSTRUCTION}" - +packer init packer ${INSTRUCTION} ${EXTRA_VARS} TASK_STATUS=$? From 8586ba62e2efcdb8e86eb2faaade43b42184a6fd Mon Sep 17 00:00:00 2001 From: Aakash Tripathi Date: Mon, 2 Dec 2024 20:01:25 +0530 Subject: [PATCH 12/12] Updating build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index 22cba46..acba686 --- a/build.sh +++ b/build.sh @@ -12,7 +12,7 @@ sleep $SLEEP_DURATION cd ${WORKSPACE}/${CODEBASE_DIR}/${PACKER_DIR} logInfoMessage "packer ${INSTRUCTION}" -packer init + packer ${INSTRUCTION} ${EXTRA_VARS} TASK_STATUS=$?