Skip to content
Open
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
34 changes: 34 additions & 0 deletions .github/jobs/get_met_base_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /bin/bash

# set constants for the MET base repository names (regular and unit test)
MET_BASE_REPO_NAME=met-base
MET_BASE_UNIT_REPO_NAME=met-base-unit-test

# set MET base repo to regular repo by default for compilation check
met_base_repo=${MET_BASE_REPO_NAME}

# default MET base tag
met_base_tag=13.0

# override the MET base tag if set
if [[ -n "${met_base_tag_override}" ]]; then
met_base_tag=${met_base_tag_override}
fi

# if running unit tests, use unit_test MET base image
if [[ -n "${RUN_UNIT_TESTS}" && "${RUN_UNIT_TESTS}" == "true" ]]; then
met_base_repo=${MET_BASE_UNIT_REPO_NAME}
fi

# add -dev to the MET base repo if the tag does not start with a number
# this assumes that met-base and met-base-unit-test tags start with a number and
# development tags, e.g. branch names, do not
if [[ ! ${met_base_tag} =~ ^[0-9] ]]; then
met_base_repo=${met_base_repo}-dev
fi

echo "met_base_repo=${met_base_repo}" >> $GITHUB_OUTPUT
echo "met_base_tag=${met_base_tag}" >> $GITHUB_OUTPUT

echo met_base_repo: $met_base_repo
echo met_base_tag: $met_base_tag
37 changes: 5 additions & 32 deletions .github/jobs/set_job_controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@ run_update_truth=false
input_data_version=develop
truth_data_version=develop

# set constants for the MET base repository names (regular and unit test)
MET_BASE_REPO_NAME=met-base
MET_BASE_UNIT_REPO_NAME=met-base-unit-test

# set MET base repo to regular repo by default for compilation check
met_base_repo=${MET_BASE_REPO_NAME}

# default MET base tag
# TODO: Change 3.4 back to 3.5 after solving TC-Diag failure
met_base_tag=3.4-latest

# override the MET base tag if set
if [[ -n "${met_base_tag_override}" ]]; then
met_base_tag=${met_base_tag_override}
fi


if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then

# only run diff logic if pull request INTO
Expand Down Expand Up @@ -134,30 +117,18 @@ if [ "$run_update_truth" == "true" ] ||

fi

# if running unit tests, use unit_test MET base image and push image
# if running unit tests, push the image
if [ "$run_unit_tests" == "true" ]; then

# set MET base repo to the unit test version to get the test tools
met_base_repo=${MET_BASE_UNIT_REPO_NAME}

run_push=true

fi

# add -dev to the MET base repo if the tag does not start with a number
# this assumes that met-base and met-base-unit-test tags start with a number and
# development tags, e.g. branch names, do not
if [[ ! ${met_base_tag} =~ ^[0-9] ]]; then
met_base_repo=${met_base_repo}-dev
fi

echo "run_compile=${run_compile}" >> $GITHUB_OUTPUT
echo "run_push=${run_push}" >> $GITHUB_OUTPUT
echo "run_unit_tests=${run_unit_tests}" >> $GITHUB_OUTPUT
echo "run_diff=${run_diff}" >> $GITHUB_OUTPUT
echo "run_update_truth=${run_update_truth}" >> $GITHUB_OUTPUT
echo "met_base_repo=${met_base_repo}" >> $GITHUB_OUTPUT
echo "met_base_tag=${met_base_tag}" >> $GITHUB_OUTPUT
echo "input_data_version=${input_data_version}" >> $GITHUB_OUTPUT
echo "truth_data_version=${truth_data_version}" >> $GITHUB_OUTPUT

Expand All @@ -166,10 +137,12 @@ echo run_push: $run_push
echo run_unit_tests: $run_unit_tests
echo run_diff: $run_diff
echo run_update_truth: $run_update_truth
echo met_base_repo: $met_base_repo
echo met_base_tag: $met_base_tag
echo input_data_version: $input_data_version
echo truth_data_version: $truth_data_version

# get the METbaseimage repository and tag
export RUN_UNIT_TESTS=${run_unit_tests}
.github/jobs/get_met_base_image.sh

# get name of branch
.github/jobs/get_branch_name.sh
8 changes: 6 additions & 2 deletions .github/workflows/build_docker_and_trigger_metplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ jobs:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Get METbaseimage
id: get_met_base_image
run: .github/jobs/get_met_base_image.sh

- name: Build Docker Image
run: .github/jobs/build_docker_image.sh
env:
MET_BASE_REPO: ${{ steps.get_met_base_image.outputs.met_base_repo }}
MET_BASE_TAG: ${{ steps.get_met_base_image.outputs.met_base_tag }}
SOURCE_BRANCH: ${{ steps.get_branch_name.outputs.branch_name }}-lite
MET_BASE_REPO: met-base
MET_BASE_TAG: 3.4-latest

- name: Push Docker Image
run: .github/jobs/push_docker_image.sh
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ jobs:
- name: Create output directories
run: mkdir -p ${RUNNER_WORKSPACE}/logs

- name: Get METbaseimage
id: get_met_base_image
run: .github/jobs/get_met_base_image.sh

- name: Get branch name
id: get_branch_name
run: echo branch_name=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT

- name: SonarQube Scan in Docker
run: .github/jobs/build_sonarqube_image.sh
env:
MET_BASE_REPO: met-base
MET_BASE_TAG: 3.4-latest
MET_BASE_REPO: ${{ steps.get_met_base_image.outputs.met_base_repo }}
MET_BASE_TAG: ${{ steps.get_met_base_image.outputs.met_base_tag }}
SOURCE_BRANCH: ${{ steps.get_branch_name.outputs.branch_name }}
WD_REFERENCE_BRANCH: ${{ github.event.inputs.reference_branch }}
SONAR_SCANNER_VERSION: 5.0.1.3006
Expand Down
4 changes: 2 additions & 2 deletions internal/scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG MET_BASE_REPO=met-base
ARG MET_BASE_TAG=3.4-latest
ARG MET_BASE_REPO
ARG MET_BASE_TAG

FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <johnhg@ucar.edu>
Expand Down
4 changes: 2 additions & 2 deletions internal/scripts/docker/Dockerfile.copy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG MET_BASE_REPO=met-base-unit-test
ARG MET_BASE_TAG=3.4-latest
ARG MET_BASE_REPO
ARG MET_BASE_TAG

FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <johnhg@ucar.edu>
Expand Down
4 changes: 2 additions & 2 deletions internal/scripts/docker/Dockerfile.sonarqube
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG MET_BASE_REPO=met-base
ARG MET_BASE_TAG=3.4-latest
ARG MET_BASE_REPO
ARG MET_BASE_TAG

FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <johnhg@ucar.edu>
Expand Down