Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packerv2 #2

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions BP-BASE-SHELL-STEPS
Submodule BP-BASE-SHELL-STEPS added at 2fc561
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM hashicorp/packer

RUN apk add --no-cache --upgrade bash
RUN apk add jq

ENV SLEEP_DURATION 5s

COPY build.sh .
ADD BP-BASE-SHELL-STEPS /opt/buildpiper/shell-functions/
ENV INSTRUCTION build
ENV PACKER_DIR ""
ENV EXTRA_VARS ""
ENV ACTIVITY_SUB_TASK_CODE PACKER_STEP

ENTRYPOINT [ "./build.sh" ]
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +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/packer-step:0.1 .
```
20 changes: 20 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

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

logInfoMessage "Manage the packer code available at [$WORKSPACE] and have mounted at [${CODEBASE_DIR}/${PACKER_DIR}]"
sleep $SLEEP_DURATION


cd ${WORKSPACE}/${CODEBASE_DIR}/${PACKER_DIR}
logInfoMessage "packer ${INSTRUCTION}"

packer ${INSTRUCTION} ${EXTRA_VARS}

TASK_STATUS=$?

saveTaskStatus ${TASK_STATUS} ${ACTIVITY_SUB_TASK_CODE}