Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ stage('Build CodeDeploy Archive') {
node {
unstash 'src'
wrap.call({
sh ("./codedeploy/bin/build.sh")
sh ("./bin/build-codedeploy.sh")
})
}
}
Expand Down
26 changes: 13 additions & 13 deletions codedeploy/bin/build.sh → bin/build-codedeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASE_DIR="$DIR/.."
BUILD_DIR="$BASE_DIR/build"
ANSIBLE_DIR="$BASE_DIR/../ansible"
APPLICTION_DIR="$BASE_DIR/../application"
SRC_DIR="$BASE_DIR/../src"
VENV_DIR="$BASE_DIR/../venv"
DOCKER_DIR="$BASE_DIR/.."
ANSIBLE_DIR="$BASE_DIR/ansible"
APPLICTION_DIR="$BASE_DIR/application"
SRC_DIR="$BASE_DIR/src"

GIT_REV="$(git rev-parse --short HEAD)"
BUILD_NUMBER=${BUILD_NUMBER:-0}
Expand All @@ -39,20 +37,22 @@ fi
mkdir -p "$BUILD_DIR/socket"

echo Build docker container $CONTAINERNAME
docker build -f=Dockerfile -t "$CONTAINERNAME" "$DOCKER_DIR"
docker build -f=Dockerfile -t "$CONTAINERNAME" "$BASE_DIR"

echo Create python virtual environment
docker run --rm -v "$DOCKER_DIR:/src" "$CONTAINERNAME" /bin/bash -c \
"mkdir -p /src/venv ; \
cp -fa /app/venv/* /src/venv"
docker run \
--rm \
-v "$BASE_DIR:/src" \
"$CONTAINERNAME" \
/bin/bash -c \
"mkdir -p /src/build/venv ; \
cp -fa /app/venv/* /src/build/venv"

SOURCES="$BASE_DIR/bin
$ANSIBLE_DIR
$APPLICTION_DIR
$SRC_DIR
$BASE_DIR/appspec.yml
$BASE_DIR/bin
$VENV_DIR"
$BASE_DIR/codedeploy/appspec.yml"
for src in $SOURCES; do
cp -a "$src" "$BUILD_DIR"
done
Expand All @@ -70,7 +70,7 @@ done
)

echo Remove docker generated files
docker run --rm -v "$DOCKER_DIR:/src" "$CONTAINERNAME" /bin/bash -c \
docker run --rm -v "$BASE_DIR:/src" "$CONTAINERNAME" /bin/bash -c \
"rm -rf /src/venv"

cd "$BUILD_DIR"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions codedeploy/appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ files:
destination: /app/ansible
hooks:
ApplicationStop:
- location: bin/ApplicationStop.sh
- location: bin/codedeploy/ApplicationStop.sh
timeout: 600
BeforeInstall:
- location: bin/BeforeInstall.sh
- location: bin/codedeploy/BeforeInstall.sh
timeout: 30
AfterInstall:
- location: bin/AfterInstall.sh
- location: bin/codedeploy/AfterInstall.sh
timeout: 300
ApplicationStart:
- location: bin/ApplicationStart.sh
- location: bin/codedeploy/ApplicationStart.sh
timeout: 120
ValidateService:
- location: bin/ValidateService.sh
- location: bin/codedeploy/ValidateService.sh
timeout: 60