Skip to content

Commit

Permalink
Merge pull request #83 from qld-gov-au/QOLDEV-1013-ckan-2.11
Browse files Browse the repository at this point in the history
QOLDEV-1013 prepare for CKAN 2.11
  • Loading branch information
ThrawnCA authored Jan 6, 2025
2 parents a49bcd1 + 0d2c738 commit 66e41c5
Show file tree
Hide file tree
Showing 31 changed files with 717 additions and 412 deletions.
31 changes: 29 additions & 2 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,29 @@ commands:
usage: Build or rebuild project.
cmd: |
ahoy title "Building project"
echo "::group::pre-flight"
ahoy pre-flight
echo "::endgroup::"
echo "::group::clean"
ahoy clean
echo "::endgroup::"
echo "::group::network"
ahoy build-network
echo "::endgroup::"
echo "::group::build"
ahoy up -- --build --force-recreate
ahoy title "Build complete"
echo "::endgroup::"
echo "::group::doctor"
ahoy doctor
echo "::endgroup::"
echo "::group::info"
ahoy info 1
echo "::endgroup::"
build-network:
usage: Ensure that the amazeeio network exists.
Expand Down Expand Up @@ -68,7 +84,13 @@ commands:
usage: Show Docker logs.
cmd: |
ahoy title "Output logs"
sh bin/docker-compose.sh logs "$@"
# Loop through each container and wrap with github log groups
services=$(bin/docker-compose.sh ps --services)
for service in $services; do
echo "::group::$service"
sh bin/docker-compose.sh logs "$service"
echo "::endgroup::"
done
pull:
usage: Pull latest docker images.
Expand Down Expand Up @@ -134,7 +156,7 @@ commands:
usage: Run unit tests.
cmd: |
ahoy title 'Run unit tests'
ahoy cli 'pytest --ckan-ini=${CKAN_INI} "${APP_DIR}"/ckanext --junit-xml=test/junit/results.xml' || \
ahoy cli 'pytest --cov-report=xml --cov-append --ckan-ini=${CKAN_INI} "${APP_DIR}"/ckanext --junit-xml=test/junit/results.xml' || \
[ "${ALLOW_UNIT_FAIL:-0}" -eq 1 ]
test-bdd:
Expand All @@ -143,6 +165,11 @@ commands:
ahoy title 'Run scenario tests'
ahoy cli "rm -f test/screenshots/*"
ahoy start-ckan-job-worker
ahoy cli "pip install -r test/dev-requirements.txt"
if [ "$CKAN_VERSION" = "2.9" ]; then
echo "CKAN 2.9 last supported urllib3 is less than 1.27"
ahoy cli "pip install 'urllib3<1.27'"
fi
sleep 5
JUNIT_OUTPUT="--junit --junit-directory=test/junit/"
ahoy cli "behave $JUNIT_OUTPUT -k ${*:-test/features} $EXTRA_TAGS --tags=${BEHAVE_TAG:--format_autocomplete}" || \
Expand Down
43 changes: 0 additions & 43 deletions .circleci/config.yml

This file was deleted.

38 changes: 33 additions & 5 deletions .docker/Dockerfile-template.ckan
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,39 @@ COPY bin/ckan_cli /usr/bin/

RUN chmod +x "${APP_DIR}"/bin/*.sh /usr/bin/ckan_cli

ENV DOCKERIZE_VERSION=v0.6.1
RUN wget -O - https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \
| tar -C /usr/local/bin -xzvf -

RUN which ps || apt-get install -y procps
ENV DOCKERIZE_VERSION v0.9.1
# Install dependencies and dockerize based on the base image
RUN ARCH=$(uname -m); \
if [ -f /etc/alpine-release ]; then \
apk add --no-cache build-base curl procps; \
if [ "$ARCH" = "x86_64" ]; then \
curl -sL https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \
| tar -C /usr/local/bin -xzvf -; \
elif [ "$ARCH" = "aarch64" ]; then \
curl -sL https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-arm64-${DOCKERIZE_VERSION}.tar.gz \
| tar -C /usr/local/bin -xzvf -; \
else \
echo "Unsupported architecture on Alpine: $ARCH"; \
exit 1; \
fi; \
elif [ -f /etc/debian_version ]; then \
apt-get update && \
apt-get install -y --no-install-recommends build-essential curl procps && \
rm -rf /var/lib/apt/lists/*; \
if [ "$ARCH" = "x86_64" ]; then \
curl -sL https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \
| tar -C /usr/local/bin -xzvf -; \
elif [ "$ARCH" = "aarch64" ]; then \
curl -sL https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-linux-arm64-${DOCKERIZE_VERSION}.tar.gz \
| tar -C /usr/local/bin -xzvf -; \
else \
echo "Unsupported architecture on Debian: $ARCH"; \
exit 1; \
fi; \
else \
echo "Unsupported base image"; \
exit 1; \
fi

# Install setuptools conditionally
RUN if [ "$CKAN_VERSION" = "2.9" ]; then \
Expand Down
2 changes: 1 addition & 1 deletion .docker/test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ full_stack = true
cache_dir = /tmp/%(ckan.site_id)s/
beaker.session.key = ckan

SECRET_KEY = bSmgPpaxg2M+ZRes3u1TXwIcE
beaker.session.secret = bSmgPpaxg2M+ZRes3u1TXwIcE
SECRET_KEY = bSmgPpaxg2M+ZRes3u1TXwIcE

# `paster make-config` generates a unique value for this each time it generates
# a config file.
Expand Down
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ format = pylint
# Show the source of errors.
show_source = True
statistics = True
count = True

max-complexity = 10
max-line-length = 127
Expand Down
Loading

0 comments on commit 66e41c5

Please sign in to comment.