Skip to content
Merged
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
31 changes: 27 additions & 4 deletions .github/jobs/set_job_controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,26 @@
run_unit_tests=false
run_diff=false
run_update_truth=false
met_base_repo=met-base
# TODO: Change 3.4 back to 3.5 after solving TC-Diag failure
met_base_tag=3.4-latest
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

Check warning on line 19 in .github/jobs/set_job_controls.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this 'TODO' comment.

See more on https://sonarcloud.io/project/issues?id=dtcenter_MET&issues=AZ9nzjb7OEQn0m1BExui&open=AZ9nzjb7OEQn0m1BExui&pullRequest=3409
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 @@ -123,11 +137,20 @@
# if running unit tests, use unit_test MET base image and push image
if [ "$run_unit_tests" == "true" ]; then

met_base_repo=met-base-unit-test
# 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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on:
description: 'Run the unit tests'
default: true
type: boolean
met_base_tag:
description: 'Override the MET base tag'
default: ''
required: false

env:
DOCKERHUB_REPO: dtcenter/met-dev
Expand All @@ -57,6 +61,7 @@ jobs:
env:
commit_msg: ${{ github.event.head_commit.message }}
force_tests: ${{ github.event.inputs.force_tests }}
met_base_tag_override: ${{ github.event.inputs.met_base_tag }}

outputs:
run_compile: ${{ steps.job_status.outputs.run_compile }}
Expand Down
21 changes: 9 additions & 12 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.5-latest
ARG MET_BASE_TAG=3.4-latest

FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <johnhg@ucar.edu>
Expand All @@ -10,7 +10,7 @@ MAINTAINER John Halley Gotway <johnhg@ucar.edu>
ARG SOURCE_BRANCH

#
# SOURCE_BRANCH is not defined when built via Docker Hub.
# Fail if SOURCE_BRANCH is not defined
#
RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \
echo "ERROR: SOURCE_BRANCH undefined! Rebuild with \"--build-arg SOURCE_BRANCH={branch name}\""; \
Expand All @@ -24,11 +24,6 @@ ENV MET_REPO_DIR=/met/MET-${MET_GIT_NAME}
ENV MET_GIT_URL=https://github.com/dtcenter/MET
ENV MET_DEVELOPMENT=true

#
# Update the OS, as needed.
#
RUN apt update

#
# Set the working directory.
#
Expand All @@ -38,8 +33,10 @@ WORKDIR /met
# Download and install MET.
# Delete the MET source code for tagged releases matching "v"*.
#
RUN echo "Checking out MET ${MET_GIT_NAME} from ${MET_GIT_URL}" \
&& git clone ${MET_GIT_URL} ${MET_REPO_DIR} \
&& cd ${MET_REPO_DIR} \
&& git checkout ${MET_GIT_NAME} \
&& internal/scripts/docker/build_met_docker.sh
RUN \
echo "Checking out MET ${MET_GIT_NAME} from ${MET_GIT_URL}" &&\
git clone ${MET_GIT_URL} ${MET_REPO_DIR} \
&& echo "Build MET" &&\
(cd ${MET_REPO_DIR} &&\
git checkout ${MET_GIT_NAME} &&\
internal/scripts/docker/build_met_docker.sh)
13 changes: 4 additions & 9 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.5-latest
ARG MET_BASE_TAG=3.4-latest

FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <johnhg@ucar.edu>
Expand All @@ -24,11 +24,6 @@ ENV MET_REPO_DIR=/met/MET-${MET_GIT_NAME}
ENV MET_GIT_URL=https://github.com/dtcenter/MET
ENV MET_DEVELOPMENT=true

#
# Update the OS, as needed.
#
RUN apt update

#
# Set the working directory.
#
Expand All @@ -48,6 +43,6 @@ RUN if [ ! -e "${MET_REPO_DIR}/configure.ac" ]; then \
exit 1; \
fi

RUN cd ${MET_REPO_DIR} \
&& internal/scripts/docker/build_met_docker.sh

RUN \
echo "Build MET" &&\
(cd ${MET_REPO_DIR} && internal/scripts/docker/build_met_docker.sh)
15 changes: 5 additions & 10 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.5-latest
ARG MET_BASE_TAG=3.4-latest

FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <johnhg@ucar.edu>
Expand Down Expand Up @@ -67,11 +67,6 @@ RUN echo "Installing SonarQube into $HOME/.sonar" \
&& unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ \
&& echo export PATH="$HOME/.sonar/build-wrapper-linux-x86:\$PATH" >> $HOME/.bashrc

#
# Update the OS, as needed.
#
RUN apt update

#
# Set the working directory.
#
Expand All @@ -80,8 +75,7 @@ WORKDIR /met
#
# Copy MET Download and install MET.
#
RUN echo "Copying MET into ${MET_REPO_DIR}" \
&& mkdir -p ${MET_REPO_DIR}
RUN echo "Copying MET into ${MET_REPO_DIR}" && mkdir -p ${MET_REPO_DIR}

COPY . ${MET_REPO_DIR}

Expand All @@ -90,5 +84,6 @@ RUN if [ ! -e "${MET_REPO_DIR}/configure.ac" ]; then \
exit 1; \
fi

RUN cd ${MET_REPO_DIR} \
&& internal/scripts/docker/build_met_sonarqube.sh
RUN \
echo "Build MET for SonarQube" &&\
(cd ${MET_REPO_DIR} && internal/scripts/docker/build_met_sonarqube.sh)
2 changes: 1 addition & 1 deletion internal/scripts/environment/development.docker
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export CXXFLAGS=${CFLAGS}

# Set LDFLAGS to include -rpath settings when compiling MET
export LDFLAGS="-Wl,--disable-new-dtags"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,/usr/local/lib:/usr/lib64"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64"

# Variables required to run MET
export MET_TEST_INPUT=${MET_PROJ_DIR}/MET_test_data/unit_test
Expand Down
Loading