Skip to content

Commit 99904fc

Browse files
ikethecoderElson9rustyjux
authored
Feature/kc 26 (#1369)
* changes to get docker compose to launch cleanly * fix group issue by upgrading admin client * fix group issue by upgrading admin client * refactor keycloak admin client * try to build with openssl legacy provider * try to build with openssl legacy provider * upd all build steps with ssl flag * fix dockerfile * fix cypress * add some output to cypress automation logs * upd cypress log * use nightly keycloak and use 2 isntances in docker compose * use kc-upgrade gwa for cypress e2e * add data plane info as gwa needs for upstream validation check * fix group mgmt * Test api-key plugin with kong 3.9.0 * fix for kong-spec-expose and kong-upstream-jwt * remove commented out cypress tests * use our latest Kong 3 docker image * upgrade gwa-api version in e2e tests workflow * Fix expected error response for IP restriction * update gwa-cli to 3.0.6 for e2e * provide DECK_CLI env var, eliminate docker compose warnings * replace test host httpbin.org with httpbun.com * accept 97 to 99 * correct name of template * Retry if product/dataset fails to publish * exclude `gwa status` from e2e tests * Expect 200 when using allowed methods (POST/PUT) * add retry for `gwa apply` for two-tiered * Only enable code coverage in CI (GitHub Actions) * remove it.onlys - oops * Clear redis rate limit key before new rate limiting test * move clear redis timing * upgrade local postgres to 12.8 > 15 * bump actions/cache v2 > v4 * use postgres 14 in e2e * Changes to get docker compose to run (with authz issues) * use updated gwa-api, only run cypress tests 01 and 02 * update cypress logout action * fixes for updated keycloak ui * fix expected state for scope not found * run all tests * test 01 02 * run all tests * update node version in nvmrc and ci-feat-sonar GHA * fix decision strategy for default permission * fix and cleanup keycloak tests * more test fixes * bump postgres to 14 in docker compose * parameterize in docker compose * set rate limit to 1 for expected one successful call * add wait before Kong requests after updating auth plugin * remove echo from local kong dockerfile * merge consecutive RUN calls * add Namespace.View on Namespace creation * Add explicit pagination for Keycloak group retrieval with max 1000 * Update Jest setup with polyfills for Web APIs and updated mocks for Keycloak. Refactor error handling in BatchService. * adjust depenencies * fix UMA permission assertion * remove Namespace.View (return to previous state) * update SonarCloud Scan action * remove project from sonar arg * add api-services-portal project * restore sonar * upgrade keycloak-connect * Replacing local keycloak-admin-client package with official @keycloak/keycloak-admin-client. * stop copying keycloak-admin-client in dockerfiles * fix sonar scan action * code cleanup: use find instead of filter * code cleanup: remove await on non-promise * Add test to verify authorization scope enforcement (for ds/api) * Add ForbiddenError class and update authorization handling to use it for permission denials * cypress: update expected response code * cypress: disable documentation tests * restore cypress to v13 * cypress: add necessary role for Janis for activity tests * cypress: fix error message * Cypress: add permissions for Janis in client cred ns * cypress: force click * enable keycloak metrics and health * Cypress: add missing fixture * cypress: update expected error code to 401 for service account disabled * cypress: visit admin access page * Optimize calls to Keycloak * Fix test for keycloak optimization * kc26 logout fix * fix Missing parameters: id_token_hint when logging out * fix2: Missing parameters: id_token_hint when logging out * remove backend_logout_url * Fix redirect to home page, fix signout page typo * Portal attempt fix to redirect to /signout * Remove comment that's no longer applicable * use latest cli * better handle errors for getOrganization + getOrganizationUnit * guard gql error if org-unit is null * fix logout assertion * Few more merge conflicts, couple remaining * Another merge conflict, just package-lock remaining * fix merge conflict package-lock.json, yarn.lock update * Add skipLibCheck. This is a standard way to avoid dependency type-definition issues and is recommended when using older TypeScript with newer @types packages. * Fix portal build * Fix portal build 2 * Fix portal build 3 * Fix portal build 4 * Fix portal build 5 * Fix portal build 6 * Fix portal build 7 * Upgrade babel/core * Fix sonar tests * Fix last remaining test * Fix last remaining test 2 * Fix scope loading issue with cypress * Fix for 14/04 cypress tests * accept Namespace.Manage or View for /activity endpoints * use gwa-api `dev` branch for e2e * kc bump + minor tweaks --------- Co-authored-by: James Elson <james.elson@gov.bc.ca> Co-authored-by: Russell Vinegar <russell.vinegar@gov.bc.ca>
1 parent b8895df commit 99904fc

File tree

95 files changed

+32545
-53909
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+32545
-53909
lines changed

.dockerignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
src/node_modules
21
src/.npm
32
src/_tmp
43
src/.cache
54
src/.config
65
src/.nyc_output
76
src/dist
87
**/.next
9-
_data
8+
_data
9+
**/node_modules
10+
__coverage__

.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ EMAIL_USER=
2929
EMAIL_PASS=
3030
EXTERNAL_URL=http://oauth2proxy.localtest.me:4180
3131
OIDC_ISSUER=http://keycloak.localtest.me:9081/auth/realms/master
32+
OIDC_CLIENT_ID=aps-portal
3233
LOCAL_ENV=true
3334
WORKING_PATH=/tmp
3435
DESTINATION_URL=

.github/workflows/aps-cypress-e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- name: Build GWA API Image
2727
run: |
28-
git clone https://github.com/bcgov/gwa-api.git --branch v1.0.47
28+
git clone https://github.com/bcgov/gwa-api.git --branch dev
2929
cd gwa-api/microservices/gatewayApi
3030
docker build -t gwa-api:e2e .
3131

.github/workflows/ci-build-deploy.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
username: ${{ env.REGISTRY_USERNAME }}
5555
password: ${{ env.REGISTRY_PASSWORD }}
5656

57-
- uses: actions/cache@v3
57+
- uses: actions/cache@v4
5858
with:
5959
path: /tmp/.buildx-cache
6060
key: ${{ runner.os }}-buildx-${{ github.sha }}
@@ -318,6 +318,9 @@ jobs:
318318
- name: X-Forwarded-Access-Token
319319
values:
320320
- claim: access_token
321+
- name: X-Forwarded-Id-Token
322+
values:
323+
- claim: IDToken
321324
injectResponseHeaders: []
322325
metricsServer:
323326
BindAddress: ""
@@ -394,6 +397,8 @@ jobs:
394397
secure: true
395398
OIDC_ISSUER:
396399
value: '${{ secrets.OIDC_ISSUER }}'
400+
OIDC_CLIENT_ID:
401+
value: '${{ secrets.OIDC_CLIENT_ID }}'
397402
JWKS_URL:
398403
value: '${{ secrets.OIDC_ISSUER }}/protocol/openid-connect/certs'
399404
EXTERNAL_URL:

.github/workflows/ci-build-feeders.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
username: ${{ env.REGISTRY_USERNAME }}
3939
password: ${{ env.REGISTRY_PASSWORD }}
4040

41-
- uses: actions/cache@v3
41+
- uses: actions/cache@v4
4242
with:
4343
path: /tmp/.buildx-cache
4444
key: ${{ runner.os }}-buildx-${{ github.sha }}

.github/workflows/ci-build-only.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
username: ${{ env.REGISTRY_USERNAME }}
4747
password: ${{ env.REGISTRY_PASSWORD }}
4848

49-
- uses: actions/cache@v3
49+
- uses: actions/cache@v4
5050
with:
5151
path: /tmp/.buildx-cache
5252
key: ${{ runner.os }}-buildx-${{ github.sha }}

.github/workflows/ci-feat-sonar.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ jobs:
4848
docker compose down
4949
5050
- name: SonarCloud Scan
51-
uses: sonarsource/sonarqube-scan-action@master
51+
uses: sonarsource/sonarqube-scan-action@v6
52+
with:
53+
args: >
54+
-Dsonar.organization=bcgov-sonarcloud
55+
-Dsonar.projectKey=bcgov_api-services-portal
56+
-Dsonar.sources=src/auth,src/authz,src/batch,src/services
57+
-Dsonar.javascript.lcov.reportPaths=./src/__coverage__/lcov.info
5258
env:
5359
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5460
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61+
SONAR_HOST_URL: https://sonarcloud.io

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
echo "::set-output name=APP_REVISION::${GITHUB_SHA}"
4545
id: set-deploy-id
4646

47-
- uses: actions/cache@v3
47+
- uses: actions/cache@v4
4848
with:
4949
path: /tmp/.buildx-cache
5050
key: ${{ runner.os }}-buildx-${{ github.sha }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.15.1
1+
v22.21.1

docker-compose.yml

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,52 @@ secrets:
1111

1212
services:
1313
keycloak:
14-
image: quay.io/keycloak/keycloak:15.1.1
14+
image: keycloak-quarkus:e2e
1515
container_name: keycloak
16-
hostname: keycloak
16+
build:
17+
context: local/keycloak
18+
dockerfile: Dockerfile
19+
args:
20+
- KC_VERSION=${KC_VERSION:-26.5.3}
1721
depends_on:
1822
kong-db:
1923
condition: service_healthy
24+
environment:
25+
KC_BOOTSTRAP_ADMIN_USERNAME: admin
26+
KC_BOOTSTRAP_ADMIN_PASSWORD: local
27+
# Keycloak 26 Hostname v2: --hostname accepts full URL (host + port + path).
2028
command:
2129
[
22-
'-b',
23-
'0.0.0.0',
24-
'-Djboss.socket.binding.port-offset=1001',
25-
'-Dkeycloak.migration.action=import',
26-
'-Dkeycloak.migration.provider=singleFile',
27-
'-Dkeycloak.migration.file=/tmp/realm-config/master-realm.json',
28-
'-Dkeycloak.migration.strategy=OVERWRITE_EXISTING',
29-
'-Dkeycloak.profile.feature.upload_scripts=enabled',
30+
"start",
31+
"--optimized",
32+
"--hostname",
33+
"http://keycloak.localtest.me:9081/auth",
34+
"--db-url",
35+
"jdbc:postgresql://kong-db/${KEYCLOAK_DB_NAME:-keycloak}",
36+
"--db-username",
37+
"keycloakuser",
38+
"--db-password",
39+
"keycloakuser",
40+
"--http-enabled",
41+
"true",
42+
"--http-port",
43+
"9081",
44+
"--import-realm",
3045
]
31-
ports:
32-
- 9081:9081/tcp
33-
environment:
34-
#KEYCLOAK_USER: local
35-
#KEYCLOAK_PASSWORD: local
36-
DB_VENDOR: POSTGRES
37-
DB_SCHEMA: public
38-
DB_ADDR: kong-db:5432
39-
DB_USER: keycloakuser
40-
DB_PASSWORD: keycloakuser
4146
volumes:
42-
- ./local/keycloak/master-realm.json:/tmp/realm-config/master-realm.json
47+
- ./local/keycloak/master-realm.json:/opt/keycloak/data/import/master-realm.json
48+
ports:
49+
- 9081:9081
50+
- 9000:9000
4351
networks:
4452
aps-net:
4553
aliases:
4654
- keycloak.localtest.me
55+
healthcheck:
56+
test: timeout 10s bash -c ':> /dev/tcp/localhost/9081'
57+
interval: 5s
58+
timeout: 5s
59+
retries: 5
4760
oauth2-proxy:
4861
image: quay.io/oauth2-proxy/oauth2-proxy:v7.8.1
4962
container_name: oauth2-proxy
@@ -62,7 +75,7 @@ services:
6275
- oauth2proxy.localtest.me
6376
apsportal:
6477
container_name: apsportal
65-
image: apsportal:latest
78+
image: apsportal:${APSPORTAL_TAG:-latest}
6679
depends_on:
6780
- keycloak
6881
build:
@@ -198,7 +211,7 @@ services:
198211
aliases:
199212
- redis-master
200213
gwa-api:
201-
image: gwa-api:e2e
214+
image: gwa-api:${GWA_API_TAG:-e2e}
202215
container_name: gwa-api
203216
entrypoint: sh -c "chmod +x /tmp/gwa/entrypoint.sh && sh /tmp/gwa/entrypoint.sh"
204217
ports:

0 commit comments

Comments
 (0)