From c453cd35adfc92e67a630993d1f79e6a5273c8a5 Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Tue, 20 Aug 2024 10:56:26 +0200 Subject: [PATCH] Align with main branch --- .github/workflows/complementary-config-test.yaml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/pyspy-profiling.yaml | 12 ++++++------ .github/workflows/test-prod.yaml | 4 ++-- .github/workflows/test.yml | 2 +- Dockerfile | 2 -- docker/files/remap-user.sh | 9 ++++----- 7 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/complementary-config-test.yaml b/.github/workflows/complementary-config-test.yaml index 96f32dbd..4488c0f7 100644 --- a/.github/workflows/complementary-config-test.yaml +++ b/.github/workflows/complementary-config-test.yaml @@ -63,5 +63,5 @@ jobs: docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml up -d --wait docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml exec -T ows /bin/sh -c "datacube system init; datacube system check" docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml exec -T ows /bin/sh -c "curl https://raw.githubusercontent.com/GeoscienceAustralia/dea-config/master/dev/services/wms/inventory.json -o /tmp/inventory.json" - docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows /bin/sh -c "cd /code; ./compare-cfg.sh" + docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows /bin/sh -c "cd /code && ./compare-cfg.sh" docker compose -f docker-compose.yaml -f docker-compose.cleandb.yaml down diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 353213bb..c9572d03 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,12 +8,12 @@ on: - 'develop-1.9' paths: - '**' - - '.github/workflows/lint.yml' - '!docs/**' - '!*.rst' - '!*.md' - '!datacube_ows/__init__.py' - '!.github/**' + - '.github/workflows/lint.yml' push: branches: @@ -21,12 +21,12 @@ on: - 'develop-1.9' paths: - '**' - - '.github/workflows/lint.yml' - '!docs/**' - '!*.rst' - '!*.md' - '!datacube_ows/__init__.py' - '!.github/**' + - '.github/workflows/lint.yml' jobs: pylint: diff --git a/.github/workflows/pyspy-profiling.yaml b/.github/workflows/pyspy-profiling.yaml index 6d9f4523..82c7ba05 100644 --- a/.github/workflows/pyspy-profiling.yaml +++ b/.github/workflows/pyspy-profiling.yaml @@ -8,24 +8,24 @@ on: - 'develop-1.9' paths: - '**' - - '.github/workflows/pyspy-profiling.yaml' - '!docs/**' - '!*.rst' - '!*.md' - '!datacube_ows/__init__.py' - '!.github/**' + - '.github/workflows/pyspy-profiling.yaml' push: branches: - 'master' paths: - '**' - - '.github/workflows/pyspy-profiling.yaml' - '!docs/**' - '!*.rst' - '!*.md' - '!datacube_ows/__init__.py' - '!.github/**' + - '.github/workflows/pyspy-profiling.yaml' jobs: build: @@ -56,9 +56,9 @@ jobs: export LOCAL_UID=$(id -u $USER) export LOCAL_GID=$(id -g $USER) export $(grep -v '^#' .env_simple | xargs) - echo "::set-output name=PID::$(docker inspect --format '{{.State.Pid}}' $(docker inspect -f '{{.Name}}' \ - $(docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml ps -q ows) \ - | cut -c2-))" + echo "PID=$(docker inspect --format '{{.State.Pid}}' $(docker inspect -f '{{.Name}}' \ + $(docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml ps -q ows) \ + | cut -c2-))" > $GITHUB_OUTPUT - name: Run py-spy profiling (stage 1 - run profiling service) timeout-minutes: 1 @@ -68,7 +68,7 @@ jobs: export LOCAL_GID=$(id -g $USER) export $(grep -v '^#' .env_simple | xargs) docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml \ - exec -T ows /bin/sh -c "cd /code;./test_urls.sh &" + exec -T ows /bin/sh -c "cd /code && ./test_urls.sh &" docker compose -f docker-compose.yaml -f docker-compose.db.yaml -f docker-compose.pyspy.yaml \ run pyspy record -f speedscope -o ./artifacts/profile.json --duration 30 \ --pid ${{steps.set-output-container-id.outputs.PID}} --subprocesses diff --git a/.github/workflows/test-prod.yaml b/.github/workflows/test-prod.yaml index 4111a900..b13c326b 100644 --- a/.github/workflows/test-prod.yaml +++ b/.github/workflows/test-prod.yaml @@ -7,24 +7,24 @@ on: - 'master' paths: - '**' - - '.github/workflows/test-prod.yaml' - '!docs/**' - '!*.rst' - '!*.md' - '!datacube_ows/__init__.py' - '!.github/**' + - '.github/workflows/test-prod.yaml' push: branches: - 'master' paths: - '**' - - '.github/workflows/test-prod.yaml' - '!docs/**' - '!*.rst' - '!*.md' - '!datacube_ows/__init__.py' - '!.github/**' + - '.github/workflows/test-prod.yaml' env: ORG: opendatacube diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c89e8ee2..c2281995 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,9 +60,9 @@ jobs: - name: Dockerized Integration Pytest run: | - export $(grep -v '^#' .env_simple | xargs) export LOCAL_UID=$(id -u $USER) export LOCAL_GID=$(id -g $USER) + export $(grep -v '^#' .env_simple | xargs) docker compose -f docker-compose.yaml -f docker-compose.db.yaml up -d --wait --build docker compose -f docker-compose.yaml -f docker-compose.db.yaml exec -T ows /bin/sh -c "cd /code && ./check-code-all.sh" docker compose -f docker-compose.yaml -f docker-compose.db.yaml down diff --git a/Dockerfile b/Dockerfile index aa752873..bf69f07b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,8 +69,6 @@ RUN EXTRAS=$([ "$ENVIRONMENT" = "deployment" ] || echo ",test") && \ python3-pip)) # Configure user -RUN userdel -r ubuntu -RUN useradd -m -s /bin/bash ows WORKDIR "/home/ubuntu" ENV GDAL_DISABLE_READDIR_ON_OPEN="EMPTY_DIR" \ diff --git a/docker/files/remap-user.sh b/docker/files/remap-user.sh index 8f582629..fbe32e60 100755 --- a/docker/files/remap-user.sh +++ b/docker/files/remap-user.sh @@ -1,14 +1,13 @@ #!/bin/bash -e # Script that gives the container user uid $LOCAL_UID and gid $LOCAL_GID. -# If $LOCAL_UID or $LOCAL_GID are not set, they default to 1001 (default +# If $LOCAL_UID or $LOCAL_GID are not set, they default to 1000 (default # for the first user created in Ubuntu). USER_ID=${LOCAL_UID:-1000} GROUP_ID=${LOCAL_GID:-1000} -OWS_ID=$(id -u ows) -[[ "$USER_ID" == "$OWS_ID" ]] || usermod -u $USER_ID -o -m -d /home/ows ows -[[ "$GROUP_ID" == "$OWS_ID" ]] || groupmod -g $GROUP_ID ows -[[ $(id -u) != "0" ]] || GOSU="/usr/sbin/gosu ows" +[[ "$USER_ID" == "1000" ]] || usermod -u $USER_ID -o -m -d /home/ubuntu ubuntu +[[ "$GROUP_ID" == "1000" ]] || groupmod -g $GROUP_ID ubuntu +[[ $(id -u) != "0" ]] || GOSU="/usr/sbin/gosu ubuntu" exec /usr/bin/tini -- $GOSU "$@"