diff --git a/.circleci/config.yml b/.circleci/config.yml index bf5d864..abfd4cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,7 @@ version: 2 # Run static code analyzer for SourceCloud # Upload test results # Every run command should start with source ${INIT_ENV} to ensure all default dependancies are available - +# TODO:(CAR-6030) Move to github actions to remove branch/version coupling jobs: build: # Pull docker image from docker hub diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..6ea9b53 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,9 @@ +name: Docker build + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + docker: + uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main \ No newline at end of file diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml new file mode 100644 index 0000000..77c53d2 --- /dev/null +++ b/.github/workflows/dockerhub.yml @@ -0,0 +1,17 @@ +name: Docker Hub build + +on: + push: + branches: + - develop + - master + - "release/*" + tags: + - "carma-system-*" + +jobs: + dockerhub: + uses: usdot-fhwa-stol/actions/.github/workflows/dockerhub.yml@main + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0a1510b..1d7b559 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,12 @@ # License for the specific language governing permissions and limitations under # the License. -FROM usdotfhwastoldev/carma-base:develop as deps - +ARG DOCKER_ORG="usdotfhwastoldev" +ARG DOCKER_TAG="develop" +FROM ${DOCKER_ORG}/carma-base:${DOCKER_TAG} as deps FROM deps as setup +ARG GIT_BRANCH="develop" ARG ROS1_PACKAGES="" ENV ROS1_PACKAGES=${ROS1_PACKAGES} @@ -24,7 +26,7 @@ ENV ROS2_PACKAGES=${ROS2_PACKAGES} RUN mkdir ~/src COPY --chown=carma . /home/carma/src/ -RUN ~/src/docker/checkout.bash +RUN ~/src/docker/checkout.bash -b ${GIT_BRANCH} RUN ~/src/docker/install.sh FROM deps diff --git a/docker/checkout.bash b/docker/checkout.bash index 24a9925..f35b3ea 100755 --- a/docker/checkout.bash +++ b/docker/checkout.bash @@ -20,11 +20,13 @@ set -exo pipefail dir=~ +BRANCH=develop while [[ $# -gt 0 ]]; do arg="$1" case $arg in - -d|--develop) - BRANCH=develop + -b|--branch) + BRANCH=$2 + shift shift ;; -r|--root) @@ -35,10 +37,5 @@ while [[ $# -gt 0 ]]; do esac done -if [[ "$BRANCH" = "develop" ]]; then - git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ~/src/CARMAMsgs --branch $BRANCH - git clone https://github.com/usdot-fhwa-stol/carma-utils.git ~/src/CARMAUtils --branch $BRANCH -else - git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/src/CARMAMsgs --branch develop - git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/src/CARMAUtils --branch develop -fi +git clone https://github.com/usdot-fhwa-stol/carma-msgs.git "${dir}"/src/CARMAMsgs --branch "${BRANCH}" +git clone https://github.com/usdot-fhwa-stol/carma-utils.git "${dir}"/src/CARMAUtils --branch "${BRANCH}"