Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Node 22, bug fixes #1220

Merged
merged 39 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6b4eb86
tweak style for gateway list item hover (#1184)
rustyjux Oct 22, 2024
50433c8
fix tests to handle redirect away from your products (#1185)
rustyjux Nov 6, 2024
a36e672
add PR review reminders
rustyjux Dec 9, 2024
acb9071
set OS for Jira GHA runner
rustyjux Dec 16, 2024
1df2aab
Update GitHub Actions to use CodeQL SARIF upload v2 in image scan wor…
rustyjux Dec 16, 2024
f3bbbd3
Update GitHub Actions to use CodeQL SARIF upload v3 in image scan wor…
rustyjux Dec 16, 2024
e21eafa
Remove deprecated acs-report-enable option from Anchore image scan wo…
rustyjux Dec 16, 2024
bc59a96
Update Dockerfiles to use Node.js 22
rustyjux Dec 17, 2024
184c5f3
update reminder schedule
rustyjux Dec 17, 2024
cc306eb
adjust PR reminder timing
rustyjux Dec 17, 2024
091b77e
update ns --> gw in API endpoint names and descriptions
rustyjux Dec 17, 2024
3c4c009
Update Node.js engine requirement in package.json to support versions…
rustyjux Dec 20, 2024
e964a72
Avoid socket hangup: enhance Keycloak auth in group service with retr…
rustyjux Dec 20, 2024
afea353
Enhance Cypress E2E test logging in GitHub Actions workflow; added cu…
rustyjux Dec 20, 2024
3075f09
bump cli version in tests
rustyjux Dec 21, 2024
f472539
modify show cypress progress
rustyjux Dec 24, 2024
5b04995
peg ubuntu version for GHA runner, stream all cypress logs
rustyjux Dec 24, 2024
00bc2d0
use ubuntu-latest, gwa-api v1.0.40
rustyjux Dec 31, 2024
1eed10b
add data_plane_config for gwa api
rustyjux Dec 31, 2024
23932d8
disable migrate user tests
rustyjux Jan 2, 2025
b95c0a3
fix error msg for generate-config service validation
rustyjux Jan 3, 2025
dab5b6d
Change regex validation in utils.ts to use assert.ok
rustyjux Jan 3, 2025
ebf6f2b
Update error message for Gateway ID validation
rustyjux Jan 3, 2025
231a4cd
upgrade node-fetch
rustyjux Jan 3, 2025
406337b
ensure subsequent steps are run in aps-cypress-e2e GHA
rustyjux Jan 3, 2025
cb4b85d
enable astra scan
rustyjux Jan 3, 2025
cf0fc04
upgrade upload-sarif for trivy, try fixing output path for anchore
rustyjux Jan 3, 2025
e8a4060
Merge pull request #1211 from bcgov/scan/node-upgrade
rustyjux Jan 3, 2025
0f1d356
Refactor GitHub Actions workflow for Cypress E2E tests
rustyjux Jan 6, 2025
47d3f00
Trigger E2E tests on PRs to `dev`
rustyjux Jan 6, 2025
46e23ad
Try different redirect to detail page from list page
Elson9 Jan 6, 2025
ed30e19
Revert change
Elson9 Jan 6, 2025
5e8d9c0
update sonar scan action in sonar GHA workflow
rustyjux Jan 7, 2025
5fca87f
fix for click on gateway error (#1217)
ikethecoder Jan 13, 2025
39c30d4
Revert "Avoid socket hangup: enhance Keycloak auth in group service w…
rustyjux Jan 14, 2025
b6d32fa
Merge pull request #1215 from bcgov/feature/node-upgrade
rustyjux Jan 14, 2025
5055584
Transform dataset contacts to string (#1218)
Elson9 Jan 16, 2025
b8628d0
Update gateway ID validation error message
rustyjux Jan 25, 2025
7fa55ad
remove additional logging in KeycloakGroupService
rustyjux Jan 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 42 additions & 26 deletions .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
workflow_dispatch: {}
push:
branches: ['test', 'cypress/*']
pull_request:
branches: ['dev']

env:
DASHBOARD_PROJECT_ID: ${{ secrets.CY_DASHBOARD_PRJ_ID }}
Expand All @@ -21,7 +23,7 @@ jobs:
steps:
- name: Build GWA API Image
run: |
git clone https://github.com/bcgov/gwa-api.git
git clone https://github.com/bcgov/gwa-api.git --branch v1.0.40
cd gwa-api/microservices/gatewayApi
docker build -t gwa-api:e2e .

Expand All @@ -47,60 +49,50 @@ jobs:

- name: Execute Tests & Clean Up
run: |
# Start following logs in the background with continuous output
docker logs -f cypress-e2e 2>&1 &
LOG_PID=$!

while true; do
if [ "$(docker ps -aq -f status=exited -f name=cypress-e2e)" ]; then
echo "Cypress tests completed."
# cleanup
docker compose down
break
else
echo "Waiting for Cypress to Complete E2E Tests....."
sleep 1m
sleep 30s
fi
done

- name: Upload E2E Test Results HTML Report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-html
path: ${{ github.workspace }}/e2e/results/report

- name: Upload E2E Test Results JSON Report
if: always()
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
if: always()
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: ${{ github.workspace }}/e2e/coverage

- name: Instrument the code for coverage analysis
run: |
# Rewrite the paths as the coverage starts with '../app'!
sed -e 's/..\/app/./g' ./e2e/coverage/lcov.info > lcov.info

#cd src
#npm install --legacy-peer-deps
#npx nyc instrument --compact=false . --in-place

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
- name: Upload Astra scan results
uses: actions/upload-artifact@v4
with:
args: >
-Dsonar.organization=bcgov-oss
-Dsonar.projectKey=aps-portal-e2e
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.projectBaseDir=src
-Dsonar.sources=.
-Dsonar.exclusions=nextapp/**,mocks/**,test/**,tools/**,*.json,*.js
-Dsonar.javascript.lcov.reportPaths=/github/workspace/lcov.info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

name: astra-scan-results
path: ${{ github.workspace }}/e2e/cypress/fixtures/state/scanResult.json

- name: Check for failed tests and create Issue
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -122,6 +114,30 @@ jobs:
exit 1
fi

- name: Instrument the code for coverage analysis
run: |
# Rewrite the paths as the coverage starts with '../app'!
sed -e 's/..\/app/./g' ./e2e/coverage/lcov.info > lcov.info

#cd src
#npm install --legacy-peer-deps
#npx nyc instrument --compact=false . --in-place

- name: SonarCloud Scan
uses: sonarsource/sonarqube-scan-action@master
with:
args: >
-Dsonar.organization=bcgov-oss
-Dsonar.projectKey=aps-portal-e2e
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.projectBaseDir=src
-Dsonar.sources=.
-Dsonar.exclusions=nextapp/**,mocks/**,test/**,tools/**,*.json,*.js
-Dsonar.javascript.lcov.reportPaths=/github/workspace/lcov.info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Set up Python 3.9
if: failure()
uses: actions/setup-python@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-anchore-img-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: anchore/scan-action@main
with:
image: 'bcgov/api-services-portal:anchore-scan'
acs-report-enable: true
fail-build: false
output-file: 'anchore-results.sarif'
- name: Upload Anchore Scan Results
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
sarif_file: anchore-results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/ci-feat-sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
docker compose down

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
uses: sonarsource/sonarqube-scan-action@master
with:
args: >
-Dsonar.organization=bcgov-oss
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-trivy-img-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
- name: Upload Trivy Scan Results
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
2 changes: 1 addition & 1 deletion .github/workflows/jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [issues, issue_comment]
jobs:
sync-issues:
name: Sync issues to Jira
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: ikethecoder/sync-issues-github-jira@dev
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pr-reminder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Send review reminders'
on:
schedule:
- cron: '30 13 * * 1,2,3,4,5' # Scheduled to run at 5:30 AM PST, weekdays

jobs:
remind:
runs-on: ubuntu-latest
steps:
- name: Run PR reviewer reminder
uses: bcgov/aps-devops/pr-reminder@dev
with:
token: ${{ secrets.GITHUB_TOKEN }}
dry_run: "false"
2 changes: 1 addition & 1 deletion .github/workflows/scripts/feeder-init/legal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ entity: Legal
record:
id: "terms-of-use-for-api-gateway-1"
title: "Terms of Use for API Gateway"
link: "https://www2.gov.bc.ca/gov/content/data/open-data/api-terms-of-use-for-ogl-information"
link: "https://www2.gov.bc.ca/gov/content/data/policy-standards/open-data/api-terms-of-use-for-ogl-information"
document: terms-of-use
version: 1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#FROM node:lts-alpine3.17
FROM node:16.14.2-alpine3.15
FROM node:22.12.0-alpine3.21

ARG APP_VERSION
ENV NEXT_PUBLIC_APP_VERSION=${APP_VERSION}
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/v3.0.4/gwa_Linux_x86_64.tgz \
RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.5/gwa_Linux_x86_64.tgz \
&& tar -xzf gwa_Linux_x86_64.tgz \
&& mv gwa /usr/local/bin/.

Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineConfig({
'./cypress/tests/07-*/*.ts',
'./cypress/tests/03-*/*.ts',
'./cypress/tests/04-*/*.ts',
'./cypress/tests/05-*/*.ts',
// './cypress/tests/05-*/*.ts',
'./cypress/tests/08-*/*.ts',
'./cypress/tests/09-*/*.ts',
'./cypress/tests/10-*/*.ts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('Verify CLI commands for generate/apply config', () => {
cy.executeCliCommand('gwa gateway create --generate').then((response) => {
const namespace = response.stdout.match(/\bgw-\w+/g)[0]
cy.executeCliCommand(command).then((response) => {
expect(response.stderr).to.contain(`Error: Service ${serviceName} is already in use. Suggestion: ${namespace}-${serviceName}`)
expect(response.stderr).to.contain(`Error: Checking service availability: Service ${serviceName} is already in use. Suggestion: ${namespace}-${serviceName}`)
});
});
})
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/tests/19-api-v3/03-gateways.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('Gateways', () => {
details: {
d0: {
message:
'Namespace name must be between 5 and 15 alpha-numeric lowercase characters and start and end with an alphabet.',
'Gateway ID must be between 5 and 15 lowercase alpha-numeric characters and start with a letter.',
},
},
}
Expand Down
10 changes: 7 additions & 3 deletions e2e/cypress/tests/20-gateways/02-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ describe('Gateway selector dropdown', () => {

it('Get current total number of gateways', () => {
// Create a new gateway to ensure there is at least one gateway
cy.createGateway();
cy.createGateway().then((response) => {
const namespace = response.gatewayId
cy.log('New namespace created: ' + namespace)
cy.activateGateway(namespace);
});

cy.visit(ad.yourProductsPath);
cy.get('[data-testid="ns-dropdown-btn"]').click();
Expand Down Expand Up @@ -81,8 +85,8 @@ describe('Gateway selector dropdown', () => {
it('Recently used gateways are shown in the dropdown', () => {
cy.visit(ns.listPath)
cy.get(`[data-testid="ns-list-activate-link-${gateways["namespace1"].gatewayId + '-' + customId}"]`).click()
cy.get('[data-testid="ns-dropdown-btn"]').click()
cy.get(`[data-testid="ns-dropdown-item-${gateways["namespace2"].gatewayId + '-' + customId}"]`).click()
cy.visit(ns.listPath)
cy.get(`[data-testid="ns-list-activate-link-${gateways["namespace2"].gatewayId + '-' + customId}"]`).click()
cy.get('[data-testid="ns-dropdown-btn"]').click()
cy.get('[data-testid="ns-dropdown-heading"]').should('contain.text', "Recently viewed")
cy.get(`[data-testid="ns-dropdown-item-${gateways["namespace1"].gatewayId + '-' + customId}"]`).should('exist')
Expand Down
2 changes: 1 addition & 1 deletion feeds/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#FROM node:lts-alpine3.17
FROM node:16.14.2-alpine3.15
FROM node:22.12.0-alpine3.21

RUN apk add curl jq

Expand Down
2 changes: 1 addition & 1 deletion feeds/testdata/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"name": "travel planning"
}
],
"contacts": "[{\"name\":\"DataBC Operations\",\"email\":\"[email protected]\",\"org\":\"d2e433a1-b785-4d03-8a2b-392069175eb4\",\"role\":\"pointOfContact\",\"displayed\":true}]",
"contacts": "[{\"name\":\"DataBC Operations\",\"email\":\"[email protected]\",\"org\":\"d2e433a1-b785-4d03-8a2b-392069175eb4\",\"role\":\"pointOfContact\",\"displayed\":[\"displayed\"]}]",
"resource_status": "completed",
"tracking_summary": {
"total": 917,
Expand Down
2 changes: 1 addition & 1 deletion local/cypress-jwks-url/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.2-alpine3.15
FROM node:22.12.0-alpine3.21

WORKDIR /src

Expand Down
1 change: 1 addition & 0 deletions local/gwa-api/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ OIDC_BASE_URL=http://keycloak.localtest.me:9081/auth/realms/master
TOKEN_MATCH_AUD=gwa
WORKING_FOLDER=/tmp
CONFIG_PATH=/tmp/production.json
DATA_PLANES_CONFIG_PATH=/tmp/gwa/data_planes_config.json
ENVIRONMENT=production
KONG_ADMIN_URL=http://kong.localtest.me:8001
KC_SERVER_URL=http://keycloak.localtest.me:9081/auth/
Expand Down
9 changes: 9 additions & 0 deletions local/gwa-api/data_planes_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"data_planes": {
"local.dataplane": {
"kube-api": "https://api.cloud",
"kube-ns": "xxxxxx-dev",
"validate-upstreams": false
}
}
}
2 changes: 1 addition & 1 deletion local/html-sample-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.2-alpine3.15
FROM node:22.12.0-alpine3.21

WORKDIR /src

Expand Down
2 changes: 1 addition & 1 deletion local/portal/Dockerfile.E2E
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#FROM node:lts-alpine3.18
FROM node:16.14.2-alpine3.15
FROM node:22.12.0-alpine3.21

ARG APP_VERSION
ENV APP_VERSION=${APP_VERSION}
Expand Down
2 changes: 1 addition & 1 deletion oauth2-proxy/sample-upstream/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.14.2-alpine3.15 AS BUILD
FROM node:22.12.0-alpine3.21 AS BUILD

COPY package*.json /app/

Expand Down
1 change: 1 addition & 0 deletions src/batch/data-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const metadata = {
transformations: {
tags: { name: 'toStringDefaultArray' },
resources: { name: 'toStringDefaultArray' },
contacts: { name: 'toStringDefaultArray' },
organization: {
name: 'connectOne',
key: 'organization.id',
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/v3/DatasetController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class DatasetController extends Controller {

/**
* Update metadata about a Dataset
* > `Required Scope:` Namespace.Manage
* > `Required Scope:` Gateway.Manage
*
* @summary Update Dataset
*/
Expand All @@ -66,7 +66,7 @@ export class DatasetController extends Controller {

/**
* Get metadata about a Dataset
* > `Required Scope:` Namespace.Manage
* > `Required Scope:` Gateway.Manage
*
* @summary Get Dataset
*/
Expand Down
Loading
Loading