Skip to content

Commit

Permalink
updated docker hook for release branch, system_release for circle con…
Browse files Browse the repository at this point in the history
…fig update, and renamed checkout.sh
  • Loading branch information
jtbaird committed May 18, 2020
1 parent 7530c9c commit f6e0c53
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
name: Pull Deps
command: |
source ${INIT_ENV}
./src/CARMAAvtVimbaDriver/docker/checkout.sh -r ${PWD}
./src/CARMAAvtVimbaDriver/docker/checkout.bash -r ${PWD}
- run:
name: Build Driver
command: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FROM usdotfhwastol/carma-base:3.7.0 as setup

RUN mkdir ~/src
COPY --chown=carma . /home/carma/src/CARMAAvtVimbaDriver
RUN ~/src/CARMAAvtVimbaDriver/docker/checkout.sh
RUN ~/src/CARMAAvtVimbaDriver/docker/checkout.bash
RUN ~/src/CARMAAvtVimbaDriver/docker/install.sh

FROM usdotfhwastol/carma-base:3.7.0
Expand Down
2 changes: 1 addition & 1 deletion docker/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ echo "Final image name: $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING"

cd ..
if [[ $COMPONENT_VERSION_STRING = "test" ]]; then
sed "s|usdotfhwastol|$USERNAME|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:$COMPONENT_VERSION_STRING|g; s|checkout.sh|checkout.sh -d|g" \
sed "s|usdotfhwastol|$USERNAME|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:$COMPONENT_VERSION_STRING|g; s|checkout.bash|checkout.bash -d|g" \
Dockerfile | docker build -f - --no-cache -t $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING \
--build-arg VERSION="$COMPONENT_VERSION_STRING" \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
Expand Down
File renamed without changes.
13 changes: 8 additions & 5 deletions docker/system_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# the License.

# This script takes a system release name and version number as arguments, and
# updates version dependencies in Dockerfile and /docker/checkout.sh accordingly.
# updates version dependencies in Dockerfile and /docker/checkout.bash accordingly.

# The -u | --unprompted option can be used to skip the interactive prompts, and
# provide arguments directly from the commandline.
Expand Down Expand Up @@ -47,19 +47,22 @@ if git ls-remote -q | grep $RELEASE_BRANCH; then
echo "Checking out $RELEASE_BRANCH branch."
git checkout $RELEASE_BRANCH

echo "Updating checkout.sh to point to system release version."
sed -i "s|CARMA[a-zA-Z]*_[0-9]*\.[0-9]*\.[0-9]*|$SYSTEM_RELEASE|g; s|carma-[a-zA-Z]*-[0-9]*\.[0-9]*\.[0-9]*|$SYSTEM_RELEASE|g" docker/checkout.sh
echo "Updating .circleci/config.yml base image."
sed -i "s|carma-base:.*|carma-base:$SYSTEM_RELEASE|g" .circleci/config.yml

echo "Updating checkout.bash to point to system release version."
sed -i "s|CARMA[a-zA-Z]*_[0-9]*\.[0-9]*\.[0-9]*|$SYSTEM_RELEASE|g; s|carma-[a-zA-Z]*-[0-9]*\.[0-9]*\.[0-9]*|$SYSTEM_RELEASE|g" docker/checkout.bash

echo "Updating Dockerfile to point to system release version."
sed -i "s|:CARMASystem_[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g; s|:carma-system-[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:$SYSTEM_RELEASE|g" Dockerfile

git add docker/checkout.sh Dockerfile
git add docker/checkout.bash Dockerfile

git commit -m "Updated dependencies for $SYSTEM_RELEASE"

git tag -a $SYSTEM_RELEASE -m "$SYSTEM_RELEASE version tag."

echo "Dockerfile and checkout.sh updated, committed, and tagged."
echo "Dockerfile and checkout.bash updated, committed, and tagged."
else
echo "$RELEASE_BRANCH does not exist. Exiting script."
exit 0
Expand Down
10 changes: 8 additions & 2 deletions hooks/pre_build
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash

if [[ "$SOURCE_BRANCH" = "develop" ]]; then
# add -t flag to checkout.sh and update image dependencies
sed -i "s|/checkout.sh|/checkout.sh -d|g; s|usdotfhwastol|usdotfhwastoldev|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:develop|g" \
# add -t flag to checkout.bash and update image dependencies
sed -i "s|/checkout.bash|/checkout.bash -d|g; s|usdotfhwastol|usdotfhwastoldev|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:develop|g" \
Dockerfile
elif [[ "$SOURCE_BRANCH" =~ ^release/.*$ ]]; then
# swap checkout branch in checkout.bash to release branch
sed -i "s|usdotfhwastol|usdotfhwastolcandidate|g; s|:[0-9]*\.[0-9]*\.[0-9]*|:candidate|g; s|CARMA[a-zA-Z]*_[0-9]*\.[0-9]*\.[0-9]*|candidate|g; s|carma-[a-zA-Z]*-[0-9]*\.[0-9]*\.[0-9]*|candidate|g" \
Dockerfile
sed -i "s|CARMA[a-zA-Z]*_[0-9]*\.[0-9]*\.[0-9]*|$SOURCE_BRANCH|g; s|carma-[a-zA-Z]*-[0-9]*\.[0-9]*\.[0-9]*|$SOURCE_BRANCH|g" \
docker/checkout.bash
fi

0 comments on commit f6e0c53

Please sign in to comment.