diff --git a/Makefile b/Makefile index 32bdcab..5348d5c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install test lint build-image push-image build-test-image test-in-docker run-in-docker +.PHONY: install test lint build-image build-test-image test-in-docker run-in-docker install: pip install -r requirements/core.txt -r requirements/dev.txt @@ -12,9 +12,6 @@ lint: build-image: LOCAL_SVCLIB_DIR=${LOCAL_SVCLIB_DIR} bin/build-image -push-image: - bin/push-image - build-test-image: bin/build-test-image diff --git a/bin/build-image b/bin/build-image index bc1f1d1..99c193f 100755 --- a/bin/build-image +++ b/bin/build-image @@ -5,7 +5,7 @@ set -e # source the .env file if it exists [[ -f .env ]] && source .env -image="harmonyservices/netcdf-to-zarr" +image="ghcr.io/nasa/harmony-netcdf-to-zarr" tag=${1:-latest} if [ -d "deps" ]; then diff --git a/bin/build-test-image b/bin/build-test-image index 6f94a7a..9dced1b 100755 --- a/bin/build-test-image +++ b/bin/build-test-image @@ -2,7 +2,7 @@ set -e -test_image="harmonyservices/netcdf-to-zarr-tests" +test_image="ghcr.io/nasa/harmony-netcdf-to-zarr-test" tag=${1:-latest} # We use the `host` network mode so we can have access to the diff --git a/bin/install-aws-cli b/bin/install-aws-cli deleted file mode 100755 index 0abb937..0000000 --- a/bin/install-aws-cli +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Sets up the AWS CLI to run in Bamboo - -set -e - -mkdir -p exec_bin -pushd exec_bin - -cat > aws </dev/null && echo "-i") \ - -e "AWS_ACCESS_KEY_ID=\${AWS_ACCESS_KEY_ID}" \ - -e "AWS_SECRET_ACCESS_KEY=\${AWS_SECRET_ACCESS_KEY}" \ - -e "AWS_DEFAULT_REGION=\${AWS_DEFAULT_REGION}" \ - -v "\$(pwd):/project" \ - maven.earthdata.nasa.gov/aws-cli \ - "\$@" -EOS - -chmod a+x aws - -export PATH=$PWD:$PATH -popd \ No newline at end of file diff --git a/bin/push-image b/bin/push-image deleted file mode 100755 index a6a190d..0000000 --- a/bin/push-image +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -ex - -image="harmonyservices/netcdf-to-zarr" -tag=${1:-latest} - -region=${AWS_DEFAULT_REGION:-"us-west-2"} - -account=$(aws sts get-caller-identity --output text --query 'Account') -# Need to remove \r returned on all aws commands run from Bamboo -account=${account//$'\r'/} - -# let this block fail without exiting, so that we can retry with another command if necessary -set +e -login_command=$(aws ecr get-login --no-include-email --region ${region}) -login_status=$? -# Need to remove \r returned on all aws commands run from Bamboo -login_command=${login_command//$'\r'/} -$login_command -set -e - -# the previous login failed, so try using the updated command -if [ $login_status -ne 0 ]; then - echo "Trying newer login command." - login_password=$(aws ecr get-login-password --region ${region}) - login_password=${login_password//$'\r'/} - docker login --username AWS --password $login_password ${account}.dkr.ecr.${region}.amazonaws.com -fi - -docker tag ${image}:${tag} ${account}.dkr.ecr.${region}.amazonaws.com/${image}:${tag} - -# Create ECR repo if it doesn't exist -aws ecr describe-repositories --repository-names ${image} || aws ecr create-repository --repository-name ${image} - -docker push ${account}.dkr.ecr.${region}.amazonaws.com/${image}:${tag} diff --git a/bin/run-in-docker b/bin/run-in-docker index 98cf724..67c1d4f 100755 --- a/bin/run-in-docker +++ b/bin/run-in-docker @@ -4,7 +4,7 @@ # It is meant to allow development and testing without repeatedly rebuilding the docker image. To # run a completely clean container using only what is in the image, as will be done in deployed # environments, run -# `docker run --rm -it --env-file=.env harmonyservices/netcdf-to-zarr` +# `docker run --rm -it --env-file=.env ghcr.io/nasa/harmony-netcdf-to-zarr` # If the optional environment variable LOCAL_SVCLIB_DIR is set to the directory # of a local clone of the `harmony-service-lib-py` repo, it will be mounted @@ -38,5 +38,5 @@ docker run --rm -it \ -v $(pwd):/opt/harmony-netcdf-to-zarr \ ${svclib_volume} \ --entrypoint= \ - harmonyservices/netcdf-to-zarr \ + ghcr.io/nasa/harmony-netcdf-to-zarr \ bash -c "${cmd}" diff --git a/bin/run-test b/bin/run-test new file mode 100755 index 0000000..8ccec4a --- /dev/null +++ b/bin/run-test @@ -0,0 +1,25 @@ +#!/bin/bash +############################################################################### +# Execute the nasa/harmony-netcdf-to-zarr-test Docker image as a container. +# This will run the unit test suite and check for Python linting errors. +# +# This script will output test coverage information to a `coverage` directory +# and JUnit test report output to a `test-reports` directory on the host +# machine executing this script. +# +############################################################################### + +set -ex + +# Make the directory into which XML format test reports will be saved +mkdir -p test-reports + +# Make the directory into which coverage reports will be saved +mkdir -p coverage + +# Run the tests in a Docker container with mounted volumes for XML report +# output and test coverage reporting +docker run --rm \ + -v $(pwd)/test-reports:/home/tests/reports \ + -v $(pwd)/coverage:/home/tests/coverage \ + ghcr.io/nasa/harmony-netcdf-to-zarr-test diff --git a/bin/test-in-docker b/bin/test-in-docker index 50f5566..49d1595 100755 --- a/bin/test-in-docker +++ b/bin/test-in-docker @@ -4,7 +4,7 @@ # suite. It is meant to allow development and testing without repeatedly rebuilding the docker image. To # run a completely clean container using only what is in the image, as will be done in CI environments, # run: -# `docker run --rm -it --env-file=.env harmonyservices/netcdf-to-zarr-tests` +# `docker run --rm -it --env-file=.env ghcr.io/nasa/harmony-netcdf-to-zarr-test` # If the optional environment variable LOCAL_SVCLIB_DIR is set to the directory # of a local clone of the `harmony-service-lib-py` repo, it will be mounted @@ -31,5 +31,5 @@ docker run --rm -it \ -v $(pwd):/opt/harmony-netcdf-to-zarr \ ${svclib_volume} \ --entrypoint= \ - harmonyservices/netcdf-to-zarr-tests \ + ghcr.io/nasa/harmony-netcdf-to-zarr-test \ bash -c "${cmd}" diff --git a/tests/Dockerfile b/tests/Dockerfile index 5ec0cd5..024edac 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -1,5 +1,5 @@ ARG TAG=latest -FROM harmonyservices/netcdf-to-zarr:$TAG +FROM ghcr.io/nasa/harmony-netcdf-to-zarr:$TAG COPY requirements/core.txt requirements/core.txt