Skip to content

Commit

Permalink
Updates to RTC-S1 PGE container build scripts to support v4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Collins committed Aug 7, 2023
1 parent 28df1da commit 5043196
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
7 changes: 4 additions & 3 deletions .ci/docker/Dockerfile_rtc_s1
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ COPY --chown=rtc_user:rtc_user ${PGE_SOURCE_DIR} ${PGE_DEST_DIR}
# Switch to root for installing into Conda Env
USER 0:0

SHELL ["conda", "run", "-n", "RTC", "/bin/bash", "-c"]

# Install dependencies into existing Conda Env
RUN set -ex \
&& cd ${PGE_DEST_DIR} \
&& mkdir -p ${CONDA_ROOT}/bin \
&& cp ${PGE_DEST_DIR}/opera/scripts/*_entrypoint.sh ${CONDA_ROOT}/bin \
&& chmod +x ${CONDA_ROOT}/bin/*_entrypoint.sh \
&& . ${CONDA_ROOT}/bin/activate root \
&& conda install --yes --channel conda-forge --file ${PGE_DEST_DIR}/opera/requirements.txt
&& python -m pip install -r ${PGE_DEST_DIR}/opera/requirements.txt

# Set the Docker entrypoint and clear the default command \
ENTRYPOINT ["sh", "-c", "exec ${CONDA_ROOT}/bin/pge_docker_entrypoint.sh \"${@}\"", "--"]
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "RTC", "sh", "-c", "exec ${CONDA_ROOT}/bin/pge_docker_entrypoint.sh \"${@}\"", "--"]
CMD []

# Set the user/group back to the default
Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/build_rtc_s1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ else
fi

# Build the PGE docker image
docker build ${PLATFORM} --rm --force-rm -t ${IMAGE}:${TAG} \
docker build ${PLATFORM} --progress plain --rm --force-rm -t ${IMAGE}:${TAG} \
--build-arg SAS_IMAGE=${SAS_IMAGE} \
--build-arg BUILD_DATE_TIME=${BUILD_DATE_TIME} \
--build-arg BUILD_VERSION=${TAG} \
Expand Down
16 changes: 9 additions & 7 deletions .ci/scripts/test_rtc_s1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,34 @@ DOCKER_RUN="docker run --rm \
-v ${WORKSPACE}/src/opera/test/data:${CONTAINER_HOME}/opera/test/data \
-w /workspace/${TEST_RESULTS_REL_DIR} \
-u ${UID}:$(id -g) \
--entrypoint ${CONDA_ROOT}/bin/pge_tests_entrypoint.sh \
--entrypoint conda \
${IMAGE}:${TAG}"

ENTRYPOINT="run --no-capture-output -n RTC ${CONDA_ROOT}/bin/pge_tests_entrypoint.sh"

# Configure a trap to set permissions on exit regardless of whether the testing succeeds
function set_perms {
# Open up permissions on all test results so we can be sure the CI system can
# delete them after results are archived within Jenkins
${DOCKER_RUN} bash -c "find \
${DOCKER_RUN} ${ENTRYPOINT} bash -c "find \
/workspace/${TEST_RESULTS_REL_DIR} -type d -exec chmod 775 {} +"

${DOCKER_RUN} bash -c "find \
${DOCKER_RUN} ${ENTRYPOINT} bash -c "find \
/workspace/${TEST_RESULTS_REL_DIR} -type f -exec chmod 664 {} +"
}

trap set_perms EXIT

# linting and pep8 style check (configured by .flake8 and .pylintrc)
${DOCKER_RUN} flake8 \
${DOCKER_RUN} ${ENTRYPOINT} flake8 \
--config ${CONTAINER_HOME}/opera/.flake8 \
--jobs auto \
--exit-zero \
--application-import-names opera \
--output-file /workspace/${TEST_RESULTS_REL_DIR}/${PGE_NAME}/flake8.log \
${CONTAINER_HOME}/opera

${DOCKER_RUN} pylint \
${DOCKER_RUN} ${ENTRYPOINT} pylint \
--rcfile=${CONTAINER_HOME}/opera/.pylintrc \
--jobs 0 \
--exit-zero \
Expand All @@ -78,7 +80,7 @@ ${DOCKER_RUN} pylint \
${CONTAINER_HOME}/opera

# pytest (including code coverage)
${DOCKER_RUN} bash -c "pytest \
${DOCKER_RUN} ${ENTRYPOINT} pytest \
--junit-xml=/workspace/${TEST_RESULTS_REL_DIR}/${PGE_NAME}/pytest-junit.xml \
--cov=${CONTAINER_HOME}/opera/pge/base \
--cov=${CONTAINER_HOME}/opera/pge/${PGE_NAME} \
Expand All @@ -89,7 +91,7 @@ ${DOCKER_RUN} bash -c "pytest \
/workspace/src/opera/test/pge/base \
/workspace/src/opera/test/pge/${PGE_NAME} \
/workspace/src/opera/test/scripts \
/workspace/src/opera/test/util > /workspace/${TEST_RESULTS_REL_DIR}/${PGE_NAME}/pytest.log 2>&1"
/workspace/src/opera/test/util > ${TEST_RESULTS_DIR}/pytest.log

echo "RTC-S1 PGE Docker image test complete"

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
flake8
flake8-docstrings
flake8-import-order
hdf5
h5py
Jinja2
jsonschema
Expand Down

0 comments on commit 5043196

Please sign in to comment.