Skip to content

Commit

Permalink
Merge branch 'odp-5' of https://github.com/wri/wri-odp into odp-5
Browse files Browse the repository at this point in the history
  • Loading branch information
luccasmmg committed Nov 13, 2023
2 parents 04ab174 + ff72c80 commit cbeb2da
Show file tree
Hide file tree
Showing 32 changed files with 1,055 additions and 135 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
run: sudo echo "127.0.0.1 ckan-dev" | sudo tee -a /etc/hosts
- name: Add Minio url to hosts
run: sudo echo "127.0.0.1 minio" | sudo tee -a /etc/hosts
- name: Add Frontend url to hosts
run: sudo echo "127.0.0.1 frontend" | sudo tee -a /etc/hosts
- name: Build and push CKAN image to ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Expand All @@ -58,9 +60,9 @@ jobs:
- name: Set up Docker Containers
env:
CKAN_IMAGE: '${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_CKAN_REPO }}:${{ github.sha }}'
MINIO_ROOT_USER: 'minioadmin'
MINIO_ROOT_PASSWORD: 'minioadmin'
run: docker compose -f docker-compose.test.yml --env-file .env.example up --build -d
run: |
docker compose -f docker-compose.test.yml --env-file .env.example up --build -d \
ckan-dev datapusher db solr redis minio minio-setup
working-directory: ./ckan-backend-dev
- name: Cypress Install and CKAN setup
uses: cypress-io/github-action@v6
Expand All @@ -70,16 +72,21 @@ jobs:
node-version: 18
runTests: false
working-directory: ./integration-tests
- name: Create sysadmin API for Authorization
run: bash ./ckan-backend-dev/ckan/scripts/cypress_setup.sh
- name: Set up Frontend Docker Container
env:
CKAN_IMAGE: '${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_CKAN_REPO }}:${{ github.sha }}'
run: docker compose -f docker-compose.test.yml --env-file .env.example up --build -d frontend
working-directory: ./ckan-backend-dev
- name: Cypress Install and Frontend setup
uses: cypress-io/github-action@v6
with:
wait-on: 'http://localhost:3000'
wait-on-timeout: 120
wait-on-timeout: 60
node-version: 18
runTests: false
working-directory: ./e2e-tests
- name: Create sysadmin API for Authorization
run: bash ./ckan-backend-dev/ckan/scripts/cypress_setup.sh
- name: Run Integration tests 🧪
uses: cypress-io/github-action@v6
with:
Expand All @@ -90,6 +97,12 @@ jobs:
with:
command: npm run test
working-directory: ./e2e-tests
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: /home/runner/work/wri-odp/wri-odp/e2e-tests/cypress/screenshots
if-no-files-found: ignore
- name: Copy run_unit_tests.sh
run: docker cp ./ckan/scripts/run_unit_tests.sh ckan-wri:/srv/app/run_unit_tests.sh
working-directory: ./ckan-backend-dev
Expand Down Expand Up @@ -137,7 +150,7 @@ jobs:
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ckan-trivy-results.sarif
- name: Upload Frontnend container Trivy scan results to GitHub Code scanning
- name: Upload Frontend container Trivy scan results to GitHub Code scanning
uses: github/codeql-action/upload-sarif@v2
with:
category: frontend_container_trivy_results
Expand Down
15 changes: 12 additions & 3 deletions ckan-backend-dev/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ CKAN__AUTH__ALLOW_ADMIN_COLLABORATORS=True
CKAN__AUTH__ALLOW_COLLABORATORS_TO_CHANGE_OWNER_ORG=True

# Solr
SOLR_IMAGE_VERSION=2.10-solr9
SOLR_IMAGE_VERSION=2.10-solr8
CKAN_SOLR_URL=http://solr:8983/solr/ckan
TEST_CKAN_SOLR_URL=http://solr:8983/solr/ckan

Expand All @@ -81,7 +81,7 @@ DATAPUSHER_REWRITE_RESOURCES=True
DATAPUSHER_REWRITE_URL=http://ckan-dev:5000

# Extensions
CKAN__PLUGINS=image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups wri auth hierarchy_display hierarchy_form hierarchy_group_form envvars
CKAN__PLUGINS=image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore scheming_datasets scheming_organizations scheming_groups wri auth hierarchy_display hierarchy_form hierarchy_group_form issues envvars
CKAN__VIEWS__DEFAULT_VIEWS=image_view text_view webpage_view datatables_view
CKAN__HARVEST__MQ__TYPE=redis
CKAN__HARVEST__MQ__HOSTNAME=redis
Expand All @@ -106,5 +106,14 @@ CKAN___SCHEMING__PRESETS=ckanext.wri.schema:presets.json
CKANEXT__AUTH__INCLUDE_FRONTEND_LOGIN_TOKEN=True

# custom auth
CKANEXT__WRI__ODP_URL=http://localhost:3000
CKANEXT__WRI__ODP_URL=http://frontend:3000

# Frontend Creds
NEXTAUTH_SECRET=secret
NEXTAUTH_URL=http://frontend:3000
CKAN_URL=http://ckan-dev:5000
S3_ACCESS_KEY_ID=${MINIO_ROOT_USER}
S3_SECRET_KEY_ID=${MINIO_ROOT_PASSWORD}
S3_BUCKET_NAME=ckan
S3_BUCKET_REGION=us-east-1
SYS_ADMIN_API_KEY=CKAN_API_TOKEN
11 changes: 11 additions & 0 deletions ckan-backend-dev/.env.frontend.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Minio
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
NEXTAUTH_SECRET=secret
NEXTAUTH_URL=http://localhost:3000
CKAN_URL=http://ckan-dev:5000
S3_ACCESS_KEY_ID=${MINIO_ROOT_USER}
S3_SECRET_KEY_ID=${MINIO_ROOT_PASSWORD}
S3_BUCKET_NAME=ckan
S3_BUCKET_REGION=us-east-1
SYS_ADMIN_API_KEY=CKAN_API_TOKEN
6 changes: 3 additions & 3 deletions ckan-backend-dev/ckan/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM viderum/ckan:v2.10-dev

FROM viderum/ckan:v2.10-dev-security-fix

# Set up environment variables
ENV APP_DIR=/srv/app
Expand Down Expand Up @@ -28,7 +27,8 @@ RUN pip3 install -e 'git+https://github.com/datopian/ckanext-scheming.git@ckan-2
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-s3filestore/wri/cost-splitting-orgs/requirements.txt' && \
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-s3filestore/wri/cost-splitting-orgs/dev-requirements.txt' && \
pip3 install -e 'git+https://github.com/datopian/ckanext-auth.git@auth-object-return-token#egg=ckanext-auth' && \
pip3 install -e 'git+https://github.com/ckan/ckanext-hierarchy.git@master#egg=ckanext-hierarchy'
pip3 install -e 'git+https://github.com/ckan/ckanext-hierarchy.git@master#egg=ckanext-hierarchy' && \
pip3 install -e 'git+https://github.com/datopian/[email protected]#egg=ckanext-issues'

# Update ckanext-s3filestore test.ini with minio credentials
RUN sed -i "s|ckanext.s3filestore.aws_access_key_id = test-access-key|ckanext.s3filestore.aws_access_key_id = ${AWS_ACCESS_KEY_ID}|g" src/ckanext-s3filestore/test.ini && \
Expand Down
1 change: 1 addition & 0 deletions ckan-backend-dev/ckan/scripts/cypress_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ cp ../../../integration-tests/cypress.json.example ../../../integration-tests/cy
# Replace the token placeholder with the generated token
sed -i "s/CKAN_API_TOKEN/$token/g" ../../../integration-tests/cypress.json
sed -i "s/CKAN_API_TOKEN/$token/g" ../../../e2e-tests/cypress.config.js
sed -i "s/CKAN_API_TOKEN/$token/g" ../../.env.example
Loading

0 comments on commit cbeb2da

Please sign in to comment.