Skip to content

Commit

Permalink
Feature #2138 CI enhance MET Docker tag override (#2258)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Jul 24, 2023
1 parent 5418a0a commit b3d9cee
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
11 changes: 7 additions & 4 deletions .github/jobs/docker_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ elif [ "${EXTERNAL_TRIGGER}" == "true" ]; then
MET_TAG=${MET_TAG}-lite
fi

# if MET_FORCE_TAG variable is set and not empty, use that version instead
if [ ! -z "$MET_FORCE_TAG" ]; then
MET_TAG=$MET_FORCE_TAG
MET_DOCKER_REPO=met
# if SET_MET_IMAGE variable is set and not empty, use that version instead
# format is <REPO>:<TAG> where the repo used is dtcenter/<REPO> and
# the tag used is <TAG>, e.g. met:11.1.0 uses dtcenter/met:11.1.0
if [ ! -z "$SET_MET_IMAGE" ]; then
force_info=(${SET_MET_IMAGE//:/ })
MET_DOCKER_REPO=${force_info[0]}
MET_TAG=${force_info[1]}
fi

echo Using MET_DOCKER_REPO=$MET_DOCKER_REPO
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
EXTERNAL_TRIGGER: ${{ needs.job_control.outputs.external_trigger }}
#MET_FORCE_TAG: 11.0.0
#SET_MET_IMAGE: met:11.0.0

update_data_volumes:
name: Docker Setup - Update Data Volumes
Expand Down
38 changes: 30 additions & 8 deletions docs/Contributors_Guide/continuous_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ was saved as a GitHub Secret.
Testing Workflow
================

The testing workflow file is found in **.github/workflows/testing.yml**.

Name
----

Expand Down Expand Up @@ -470,7 +472,7 @@ Create/Update METplus Docker Image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
#MET_FORCE_TAG: 10.0.0
#SET_MET_IMAGE: met:10.0.0

This job calls the **docker_setup.sh** script.
This script builds a METplus Docker image and pushes it to DockerHub.
Expand All @@ -496,15 +498,35 @@ development testing. If testing is done on a stable release, then the
corresponding MET stable release will be used. However, there may be an
instance where a change in MET breaks something in another METplus component,
i.e. METplotpy or METviewer, until a corresponding change is made to that
component. If this occurs then some of the METplus use cases may break. To
allow the tests to run successfully in the meantime, an option was added to
force the version of the MET tag that is used to build the METplus Docker image
that is used for testing. In the **testing.yml** workflow file,
there is a commented variable called
MET_FORCE_TAG that can be uncommented and set to force the version of MET to
use. This variable is found in the **get_image** job under the **env** section
component. If this occurs then some of the METplus use cases may break.

Another situation that may require a different MET Docker image is if there
are changes in a MET feature or bugfix branch that are needed to test changes
in METplus.

To allow the tests to run successfully in these cases, an option was added to
force a specific MET Docker image to be used to build the METplus Docker image
that is used for testing.

In the **testing.yml** workflow file, there is a commented variable called
SET_MET_IMAGE that can be uncommented and set the MET Docker image to use.
This variable is found in the **get_image** job under the **env** section
for the step named "Get METplus Image."

The format of the value is <REPO>:<TAG>
where the DockerHub repo used is dtcenter/<REPO> and the tag used is <TAG>.

Stable releases of MET are found in the
`dtcenter/met DockerHub repo <https://hub.docker.com/repository/docker/dtcenter/met/general>`_
and are named using the X.Y.Z version of the release,
so setting **SET_MET_IMAGE=met:11.1.0** will use dtcenter/met:11.1.0.

Development versions of MET are found in the
`dtcenter/met-dev DockerHub repo <https://hub.docker.com/repository/docker/dtcenter/met-dev/general>`_
and are named using the branch name,
so setting **SET_MET_IMAGE=met-dev:feature_XYZ_info** will use
dtcenter/met-dev:feature_XYZ_info.


.. _cg-ci-update-data-volumes:

Expand Down

0 comments on commit b3d9cee

Please sign in to comment.