Skip to content

Commit

Permalink
updates to docker/travis for release (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Aug 11, 2020
1 parent 8e0e427 commit 15e1e79
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ cache:
# OWNER_BUILD_DIR=/home/travis/build/owner_name
env:
global:
- DO_GIT_CLONE=false
- REPO_NAME=METplus
- REPO_NAME_lc=metplus

Expand All @@ -80,15 +81,16 @@ env:

- GITHUB_REPO_ORG=NCAR
- DOCKERHUB_DEFAULT_REPO=dtcenter/metplus
- DOCKERHUB_DEFAULT_TAGNAME=develop
- DOCKERHUB_DEFAULT_TAGNAME=3.1
- DOCKERHUB_MET_TAGNAME=9.1
# The DOCKERHUB_USER_REPO setting ASSUMES your owner_name
# in travis ci IS THE SAME as your docker hub user_name,
# since it is setting it based on the travis repo slug.
- DOCKERHUB_USER_REPO=dtcenter/metplus
- DOCKERHUB_USER_TAGNAME=3.1
# set to true to use default settings
# if set to false, to use DOCKER_USER_* settings, your dockerhub container.
- DOCKERHUB_USE_DEFAULT=false
- DOCKERHUB_USE_DEFAULT=true

matrix:
- TASK=docs
Expand Down Expand Up @@ -144,9 +146,7 @@ matrix:
#
- mkdir -p ${OWNER_BUILD_DIR}/pytmp.docker;
- echo "DOCKERHUB_TAG is set to *${DOCKERHUB_TAG}*"
- docker pull ${DOCKERHUB_TAG}
- docker images
- docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'which master_metplus.py;ls -al /metplus;python3 -V'
- ${TRAVIS_BUILD_DIR}/ci/travis_jobs/docker_setup.sh
- docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/pytests/run_pytests.sh docker
# Dump the output directories from running METplus
- ls -alR ${OWNER_BUILD_DIR}/pytmp.docker
Expand Down Expand Up @@ -224,7 +224,7 @@ install: # The 'install:' key, ie. travis.yml 'keys'

# execute all of the commands which
# should make the build pass or fail
before script:
before_script:

# This block defines which docker image to pull and use in all
# the jobs for the build.
Expand Down
12 changes: 12 additions & 0 deletions ci/travis_jobs/docker_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# set DO_GIT_CLONE env var to false to tell docker not to
# clone repository because travis is handling that step
export DO_GIT_CLONE=false

echo Get Docker image: ${DOCKERHUB_TAG}

# Note: adding --build-arg <arg-name> without any value tells docker to
# use value from local environment (export DO_GIT_CLONE)
docker build -t ${DOCKERHUB_TAG} --build-arg SOURCE_BRANCH=${DOCKERHUB_DEFAULT_TAGNAME} --build-arg MET_BRANCH=${DOCKERHUB_MET_TAGNAME} --build-arg DO_GIT_CLONE internal_tests/docker
docker images
docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'which master_metplus.py;ls -al /metplus;python3 -V'

5 changes: 1 addition & 4 deletions ci/travis_jobs/test_use_cases_met_tool_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ tar xfzp `basename $met_tool_wrapper_tarball`
echo Downloading $gempak_to_cf_location
curl -L -O $gempak_to_cf_location

echo Getting Docker image
docker pull ${DOCKERHUB_TAG}
docker images
docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'echo $MY_CUSTOM_VAR;which master_metplus.py;ls -al /metplus;python -V'
${TRAVIS_BUILD_DIR}/ci/travis_jobs/docker_setup.sh

echo Running tests...
docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/use_cases/run_test_use_cases.sh docker --met_tool_wrapper
Expand Down
5 changes: 1 addition & 4 deletions ci/travis_jobs/test_use_cases_model_applications.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ echo Downloading $gempak_to_cf_location
echo curl -L -O $gempak_to_cf_location
curl -L -O $gempak_to_cf_location

echo Get Docker image: ${DOCKERHUB_TAG}
docker pull ${DOCKERHUB_TAG}
docker images
docker run --rm -e "PATH=/metplus/METplus/ush:$PATH" -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash -c 'echo $MY_CUSTOM_VAR;which master_metplus.py;ls -al /metplus;python -V'
${TRAVIS_BUILD_DIR}/ci/travis_jobs/docker_setup.sh

echo Run tests...
docker run --rm -v ${OWNER_BUILD_DIR}:/metplus ${DOCKERHUB_TAG} /bin/bash /metplus/METplus/internal_tests/use_cases/run_test_use_cases.sh docker ${test_args}
Expand Down
14 changes: 8 additions & 6 deletions internal_tests/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN if [ -z ${MET_BRANCH+x} ]; then \
#
# Set working directory
#
#WORKDIR /met
WORKDIR /metplus

#
# Environment for interactive bash and csh container shells
Expand Down Expand Up @@ -63,13 +63,15 @@ RUN yum -y update \


ARG SOURCE_BRANCH
ARG DO_GIT_CLONE

# if SOURCE_BRANCH is not develop, clone the repository using the branch
# if user has not cloned from Git, clone the repository using the branch
# also replace MET_INSTALL_DIR value in default conf with correct location
RUN if [ ${SOURCE_BRANCH} != "develop" ]; then \
echo "Cloning METplus repository with -b ${SOURCE_BRANCH}"; \
git clone https://github.com/NCAR/METplus; \
RUN if [ ${DO_GIT_CLONE:-true} == true ]; then \
echo "Cloning METplus repository using branch: ${SOURCE_BRANCH}"; \
git clone --branch ${SOURCE_BRANCH} https://github.com/NCAR/METplus; \
cd METplus; \
git checkout ${SOURCE_BRANCH}; \
sed -i 's|MET_INSTALL_DIR = /path/to|MET_INSTALL_DIR = /usr/local|g' parm/metplus_config/metplus_system.conf; \
else \
echo "Running from user's local METplus repository, so don't clone through Docker"; \
fi
2 changes: 1 addition & 1 deletion internal_tests/docker/hooks/build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker build -t $IMAGE_NAME --build-arg SOURCE_BRANCH=$SOURCE_BRANCH --build-arg MET_BRANCH=9.1 .
docker build -t $IMAGE_NAME --build-arg SOURCE_BRANCH=$SOURCE_BRANCH --build-arg MET_BRANCH=9.1 --build-arg DO_GIT_CLONE=true .

0 comments on commit 15e1e79

Please sign in to comment.