Skip to content

Commit

Permalink
Merge pull request #1134 from bcgov/dev
Browse files Browse the repository at this point in the history
Feature/ns to gw (#1071)
  • Loading branch information
rustyjux authored Aug 15, 2024
2 parents 12edc4b + 13ff2d0 commit b902ab0
Show file tree
Hide file tree
Showing 283 changed files with 12,614 additions and 5,938 deletions.
21 changes: 20 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LOG_LEVEL=info
LOG_LEVEL=debug
DISABLE_LOGGING='true'
AUTH_STRATEGY=Oauth2Proxy
KNEX_HOST=kong-db
Expand Down Expand Up @@ -27,7 +27,26 @@ LOCAL_ENV=true
WORKING_PATH=/tmp
DESTINATION_URL=
SSR_API_ROOT=http://apsportal.localtest.me:3000
NEXT_PUBLIC_APP_VERSION=0.0.0
NEXT_PUBLIC_APP_REVISION=000000000000000000000000
NEXT_PUBLIC_KUBE_CLUSTER=local
NEXT_PUBLIC_HELP_DESK_URL=https://dpdd.atlassian.net/servicedesk/customer/portal/1/group/2
NEXT_PUBLIC_HELP_CHAT_URL=https://chat.developer.gov.bc.ca/channel/aps-ops
NEXT_PUBLIC_HELP_ISSUE_URL=https://github.com/bcgov/api-services-portal/issues
NEXT_PUBLIC_HELP_API_DOCS_URL=/ds/api/v3/console/
NEXT_PUBLIC_HELP_SUPPORT_URL=https://dev.developer.gov.bc.ca/docs/default/component/aps-infra-platform-docs/
NEXT_PUBLIC_HELP_RELEASE_URL=https://dev.developer.gov.bc.ca/docs/default/component/aps-infra-platform-docs/reference/releases/
NEXT_PUBLIC_HELP_STATUS_URL=https://uptime.com/s/bcgov-dss
NEXT_PUBLIC_DEVELOPER_IDS=idir,bceid,bcsc,github
NEXT_PUBLIC_PROVIDER_IDS=idir
NEXT_PUBLIC_ACCOUNT_BCEID_URL=https://www.test.bceid.ca/logon.aspx?returnUrl=/profile_management
NEXT_PUBLIC_ACCOUNT_BCSC_URL=https://idtest.gov.bc.ca/account/
NEXT_PUBLIC_GRAFANA_URL=https://grafana.local


# For automated integrated testing
TEST_PORTAL_CLIENT_ID=aps-portal
TEST_PORTAL_CLIENT_SECRET=8e1a17ed-cb93-4806-ac32-e303d1c86018
TEST_PORTAL_USERNAME=janis@idir
TEST_PORTAL_PASSWORD=awsummer

26 changes: 20 additions & 6 deletions .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ jobs:
fi
done
- name: Upload E2E Test Results Report
uses: actions/upload-artifact@v2
- name: Upload E2E Test Results HTML Report
uses: actions/upload-artifact@v4
with:
name: test-results
name: test-results-html
path: ${{ github.workspace }}/e2e/results/report

- name: Upload E2E Test Results JSON Report
uses: actions/upload-artifact@v4
with:
name: test-results-json
path: ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json

- name: Upload E2E Code Coverage Report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: ${{ github.workspace }}/e2e/coverage
Expand Down Expand Up @@ -100,8 +106,16 @@ jobs:
run: |
FAILURE_COUNT=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats.failures')
if [[ "$FAILURE_COUNT" -gt 0 ]]; then
FAILED_TESTS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.results | .[] | .suites | .[].tests | .[] | select(.fail==true) | .title')
STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats')
FAILED_TESTS=$(jq -r '
.results[] |
(.file | split("/") | .[2:] | join("/")) as $file |
.. |
.tests? // empty |
.[] |
select(.fail == true) |
"- " + $file + " - " + .title
' ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json)
STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq -r '.stats | to_entries | map("\(.key)\t\(.value)") | .[]' | column -t)
echo -e "Stats: $STATS\n\nFailed Tests:\n$FAILED_TESTS\n\nRun Link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" > msg
export MSG=$(cat msg)
gh issue create --title "FAILED: Automated Tests($FAILURE_COUNT)" --body "$MSG" --label "automation" --assignee "${{ env.GIT_COMMIT_AUTHOR }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ jobs:
NEXT_PUBLIC_HELP_ISSUE_URL:
value: 'https://github.com/bcgov/api-services-portal/issues'
NEXT_PUBLIC_HELP_API_DOCS_URL:
value: '/ds/api/v2/console/'
value: '/ds/api/v3/console/'
NEXT_PUBLIC_HELP_SUPPORT_URL:
value: 'https://developer.gov.bc.ca/docs/default/component/aps-infra-platform-docs/'
NEXT_PUBLIC_HELP_RELEASE_URL:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-feat-sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Run Tests
run: |
docker compose up kong-db -d
docker compose up keycloak -d
set -o allexport
source ./.env.local
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Run this command to test logging in and creating a namespace:

```
gwa login
gwa namespace create --name gw-12345
gwa gateway create --gateway-id gw-12345
```

### Keycloak configuration
Expand All @@ -67,17 +67,19 @@ Use the following configuration to run the Portal locally (outside of Docker) ag

1. If using Node version > 17, run `npm install --legacy-peer-deps`

1. Turn off the docker compose Portal: `docker stop apsportal`
1. Configure the `oauth2-proxy` that is running in Docker:
1. Turn off the docker compose Portal and OAuth2 Proxy: `docker stop apsportal oauth2-proxy`

1. Update `upstreams` in `local/oauth2-proxy/oauth2-proxy-local.cfg` to include the IP address of your local machine, e.g. `upstreams=["http://172.100.100.01:3000"]`
<br>You can obtain the IP address using `hostname -I`.
1. Start the OAuth2 Proxy locally:

1. Restart the oauth2-proxy: `docker compose restart oauth2-proxy`
1. Update `DESTINATION_URL` in `local/feeds/.env.local` to include the IP address of your local machine
1. Restart the feeder: `docker compose restart feeder`
1. Update `PORTAL_ACTIVITY_URL` in `local/gwa-api/.env.local` to include the IP address of your local machine
1. Restart the feeder: `docker compose restart gwa-api`
```sh
hostip=$(ifconfig en0 | awk '$1 == "inet" {print $2}')

docker run -ti --rm --name proxy --net=host \
--add-host portal.localtest.me:$hostip \
-v `pwd`/local/oauth2-proxy/oauth2-proxy-dev.cfg:/oauth2.config \
quay.io/oauth2-proxy/oauth2-proxy:v7.2.0 \
--config /oauth2.config
```

1. Start the Portal locally:

Expand Down
2 changes: 1 addition & 1 deletion e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY e2e/*.yml /e2e
COPY e2e/entrypoint.sh /tmp
ADD e2e/cypress /e2e/cypress

RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v2.0.15/gwa_Linux_x86_64.tgz \
RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.0/gwa_Linux_x86_64.tgz \
&& tar -xzf gwa_Linux_x86_64.tgz \
&& mv gwa /usr/local/bin/.

Expand Down
7 changes: 6 additions & 1 deletion e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export default defineConfig({
'./cypress/tests/16-*/*.ts',
'./cypress/tests/17-*/*.ts',
'./cypress/tests/18-*/*.ts',
'./cypress/tests/19-*/*.ts',
'./cypress/tests/20-*/*.ts',
]
return config
},
Expand All @@ -57,9 +59,10 @@ export default defineConfig({
},
chromeWebSecurity: false,
env: {
ASTRA_SCAN_ENABLED: true,
CLIENT_ID: 'aps-portal',
CLIENT_SECRET: '8e1a17ed-cb93-4806-ac32-e303d1c86018',
OIDC_ISSUER: 'http://keycloak.localtest.me:9081',
OIDC_ISSUER: 'http://keycloak.localtest.me:9081/auth/realms/master',
TOKEN_URL:
'http://keycloak.localtest.me:9081/auth/realms/master/protocol/openid-connect/token',
GWA_API_URL: 'http://gwa-api.localtest.me:2000/v2',
Expand All @@ -69,6 +72,8 @@ export default defineConfig({
BASE_URL: 'http://oauth2proxy.localtest.me:4180',
KEYCLOAK_URL: 'http://keycloak.localtest.me:9081',
WEBAPP_URL: 'http://html-sample-app.localtest.me:4242',
DEV_USERNAME: 'janis@idir',
DEV_PASSWORD: 'awsummer',
},
retries: {
runMode: 2,
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/access-manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"namespace": "permission"
},
"serviceAccount": {
"scopes": ["GatewayConfig.Publish", "Namespace.Manage", "Content.Publish"]
"scopes": ["GatewayConfig.Publish", "Gateway.Manage", "Content.Publish"]
},
"labels_consumer1": {
"labels": {
Expand Down
Loading

0 comments on commit b902ab0

Please sign in to comment.