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

chore: release to test #1327

Merged
merged 33 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b9688b5
chore: update the grafana filesystem access policies (#1320)
thegentlemanphysicist Oct 21, 2024
cf9f0f8
feat: download logs has rate limit activated (#1321)
NithinKuruba Oct 22, 2024
74a8ab1
feat: update yarn lock
NithinKuruba Oct 22, 2024
9a69434
fix: enable ssl for production env (#1322)
NithinKuruba Oct 22, 2024
c7d1e21
fix: handle database configuration
NithinKuruba Oct 22, 2024
3b24f66
fix: rollback ratelimiting
NithinKuruba Oct 22, 2024
2f6923c
feat: test rate limiting initialization #1
NithinKuruba Oct 22, 2024
3877d4e
fix: rollback ratelimiting final
NithinKuruba Oct 22, 2024
4a5feee
fix: updated token url key name (#1323)
NithinKuruba Oct 23, 2024
4c48649
feat: use redis store as cache in prod env (#1324)
NithinKuruba Oct 24, 2024
05205d0
feat: fetch redis host from tf deploy (#1328)
NithinKuruba Oct 24, 2024
44bfa5f
feat: optimize cpu and memory for grafana and redis (#1329)
NithinKuruba Oct 24, 2024
2017476
fix: sytax issue
NithinKuruba Oct 24, 2024
d67c5a9
fix: sytax issue with terraform #1
NithinKuruba Oct 24, 2024
b451ad6
fix: cpu and memory tweak
NithinKuruba Oct 24, 2024
e70c009
chore: disable archived approval (#1330)
thegentlemanphysicist Oct 29, 2024
b393fb5
chore: remove cypress cloud runs (#1332)
jlangy Oct 29, 2024
bc1d00a
fix: actions (#1333)
jlangy Oct 29, 2024
38693b6
chore: disable videos (#1334)
jlangy Oct 30, 2024
e641bce
chore: bump keycloak library (#1335)
jlangy Nov 5, 2024
cab3c4f
feat: log download (#1337)
jlangy Nov 15, 2024
f99c5d2
fix: redis config (#1338)
jlangy Nov 15, 2024
280d57a
chore: local bcsc vars (#1336)
jlangy Nov 15, 2024
d931931
feat: date order check (#1339)
jlangy Nov 16, 2024
ff86e3f
chore: svc acct username (#1340)
jlangy Nov 19, 2024
f7ff144
chore: large download (#1341)
jlangy Nov 22, 2024
5f0820a
chore: deletion emails (#1342)
jlangy Nov 26, 2024
3b01722
feat: refactored CSS API for improved performance (#1344)
NithinKuruba Dec 2, 2024
3e8ba76
fix: user deletion (#1345)
jlangy Dec 3, 2024
493a339
chore: backoff limit (#1346)
jlangy Dec 4, 2024
861714d
fix: sequalize connections (#1347)
jlangy Dec 5, 2024
63f4be8
chore: connection limit (#1349)
jlangy Dec 10, 2024
3c90da1
feat: service account roles (#1350)
jlangy Dec 10, 2024
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
81 changes: 70 additions & 11 deletions .github/workflows/e2e-keycloak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,25 @@ jobs:
summary-title: 'Pre-reqs'
wait-on: https://bcgov.github.io/sso-requests-sandbox/
wait-on-timeout: 120
record: true
install-command: yarn
working-directory: app
spec: |
cypress/e2e/**/integration-990-deleteAllIntegrations.cy.ts
browser: electron
# project: ./e2e
ci-build-id: ${{ github.event.number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore

idp-stopper:
runs-on: ubuntu-latest
Expand All @@ -60,15 +71,27 @@ jobs:
continue-on-error: false
with:
summary-title: 'E2E tests'
record: true
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/external/idpstopper-*.cy.ts
browser: electron
ci-build-id: ${{ github.event.number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore

search-users:
runs-on: ubuntu-latest
Expand All @@ -83,15 +106,27 @@ jobs:
continue-on-error: false
with:
summary-title: 'E2E tests'
record: true
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/external/search-users.cy.ts
browser: electron
ci-build-id: ${{ github.event.number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore

roles-tests:
runs-on: ubuntu-latest
Expand All @@ -106,15 +141,27 @@ jobs:
continue-on-error: false
with:
summary-title: 'E2E tests'
record: true
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/external/integration-roles.cy.ts
browser: electron
ci-build-id: ${{ github.event.number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore

integration-tests:
runs-on: ubuntu-latest
Expand All @@ -129,12 +176,24 @@ jobs:
continue-on-error: false
with:
summary-title: 'E2E tests'
record: true
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/ci/integrations-crud.cy.ts
browser: electron
ci-build-id: ${{ github.event.number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore
20 changes: 15 additions & 5 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ env:
CYPRESS_guid: ${{ secrets.CYPRESS_GUID }}
CYPRESS_loginproxy: ${{ secrets.CYPRESS_LOGINPROXY }}
CYPRESS_siteminder: ${{ secrets.CYPRESS_SITEMINDER }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_host: 'http://localhost:3000'
CYPRESS_smoketest: true
Expand All @@ -39,14 +38,25 @@ jobs:
continue-on-error: false
with:
summary-title: 'E2E tests'
record: true
wait-on: 'http://localhost:3000'
parallel: true
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/smoke/smoke-10-brokenlinks.cy.ts
cypress/e2e/ci/smoke-10-brokenlinks.cy.ts
cypress/e2e/ci/*.cy.ts
browser: electron
ci-build-id: ${{ github.event.number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore
13 changes: 8 additions & 5 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
UPTIME_STATUS_DOMAIN_NAME=status.sandbox.loginproxy.gov.bc.ca
AWS_ECR_URI=${{secrets.DEV_AWS_ECR_URI}}
INCLUDE_DIGITAL_CREDENTIAL=true
INSTALL_SSO_CSS_GRAFANA=true
INSTALL_GRAFANA=true
INSTALL_REDIS=true

INCLUDE_BC_SERVICES_CARD=true
ALLOW_BC_SERVICES_CARD_PROD=true
Expand Down Expand Up @@ -116,7 +117,8 @@ jobs:
UPTIME_STATUS_DOMAIN_NAME=status.sandbox.loginproxy.gov.bc.ca
AWS_ECR_URI=${{secrets.DEV_AWS_ECR_URI}}
INCLUDE_DIGITAL_CREDENTIAL=true
INSTALL_SSO_CSS_GRAFANA=false
INSTALL_GRAFANA=false
INSTALL_REDIS=true

INCLUDE_BC_SERVICES_CARD=true
ALLOW_BC_SERVICES_CARD_PROD=false
Expand Down Expand Up @@ -167,7 +169,8 @@ jobs:
CUSTOM_DOMAIN_NAME=api.loginproxy.gov.bc.ca
UPTIME_STATUS_DOMAIN_NAME=status.loginproxy.gov.bc.ca
AWS_ECR_URI=${{secrets.PROD_AWS_ECR_URI}}
INSTALL_SSO_CSS_GRAFANA=true
INSTALL_GRAFANA=true
INSTALL_REDIS=true
INCLUDE_DIGITAL_CREDENTIAL=true

INCLUDE_BC_SERVICES_CARD=true
Expand Down Expand Up @@ -309,7 +312,8 @@ jobs:
ms_graph_api_authority="${{secrets.MS_GRAPH_API_AUTHORITY}}"
ms_graph_api_client_id="${{secrets.MS_GRAPH_API_CLIENT_ID}}"
ms_graph_api_client_secret="${{secrets.MS_GRAPH_API_CLIENT_SECRET}}"
install_sso_css_grafana="${{ env.INSTALL_SSO_CSS_GRAFANA == 'true' && 1 || 0 }}"
install_grafana="${{ env.INSTALL_GRAFANA == 'true' && 1 || 0 }}"
install_redis="${{ env.INSTALL_REDIS == 'true' && 1 || 0 }}"

allow_bc_services_card_prod="${{env.ALLOW_BC_SERVICES_CARD_PROD}}"
include_bc_services_card="${{env.INCLUDE_BC_SERVICES_CARD}}"
Expand All @@ -319,7 +323,6 @@ jobs:
bcsc_registration_base_url_dev="${{env.BCSC_REGISTRATION_BASE_URL_DEV}}"
bcsc_registration_base_url_test="${{env.BCSC_REGISTRATION_BASE_URL_TEST}}"
bcsc_registration_base_url_prod="${{env.BCSC_REGISTRATION_BASE_URL_PROD}}"

EOF

working-directory: ./terraform
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ terraform-docs 0.12.1
tflint 0.41.0
k6 0.34.1
helm 3.10.2
bun 1.1.34
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM node:16.14.2-slim
FROM node:20.17.0-slim

RUN npm i -g bun
RUN apt-get update && apt-get install curl make -y \
&& apt-get install libsqlite3-dev bzip2 icu-devtools uuid-dev -y

Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.tf-modules
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM docker.io/hashicorp/terraform:latest
FROM docker.io/hashicorp/terraform:1.1.4

RUN apk update
RUN apk upgrade
RUN apk add --no-cache curl

# Set working directory
Expand Down
2 changes: 1 addition & 1 deletion app/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
json: true,
},
e2e: {
baseUrl: 'http://localhost:3000',
baseUrl: 'https://bcgov.github.io/sso-requests-sandbox',
projectId: 'gctfmh',
setupNodeEvents(on, config) {
on('before:browser:launch', (browser, launchOptions) => {
Expand Down
29 changes: 29 additions & 0 deletions app/jest/ssoDashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import AdminDashboard from 'pages/admin-dashboard';
import { Integration } from 'interfaces/Request';
import { sampleRequest } from './samples/integrations';
import { deleteRequest, updateRequestMetadata, updateRequest, restoreRequest, getRequestAll } from 'services/request';
import BcServicesCardTabContent from 'page-partials/admin-dashboard/AdminTabs/BcServicesCardTabContent';

import { getCompositeClientRoles } from '@app/services/keycloak';
import { debug } from 'jest-preview';

Expand Down Expand Up @@ -479,4 +481,31 @@ describe('SSO Dashboard', () => {

expect(screen.queryByText('Remove Service Account')).not.toBeInTheDocument();
});

it('BCSC Tab can approve submitted bcsc integrations', () => {
const bcServicesCardIntegration: Integration = {
...sampleRequest,
devIdps: ['bcservicescard'],
status: 'applied',
publicAccess: false,
};

render(<BcServicesCardTabContent integration={bcServicesCardIntegration} />);
const textElement = screen.getByText('To begin the BC Services Card integration in production, Click Below.');
expect(textElement).toBeInTheDocument();
});

it('BCSC Tab cannot approve archived bcsc integrations', () => {
const bcServicesCardIntegrationArchived: Integration = {
...sampleRequest,
devIdps: ['bcservicescard'],
status: 'applied',
archived: true,
publicAccess: false,
};

render(<BcServicesCardTabContent integration={bcServicesCardIntegrationArchived} />);
const textElement = screen.getByText('Cannot approve deleted/archived integrations.');
expect(textElement).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ function TabContent({ integration, type, canApproveProd, awaitingTFComplete, onA
}

let content;
if (canApproveProd) {

if (integration?.archived) {
content = (
<>
<p>Cannot approve deleted/archived integrations.</p>
</>
);
} else if (canApproveProd) {
content = (
<>
<p>{`To begin the ${displayType} integration in production, Click Below.`}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ interface Props {
* @param filename Name to give to the downloaded file
* @param dataObjToWrite The data to include in the file
*/
const saveTemplateAsFile = (filename: string, dataObjToWrite: any) => {
const blob = new Blob([JSON.stringify(dataObjToWrite)], { type: 'text/json' });
const saveTemplateAsFile = (filename: string, dataObjToWrite: Blob) => {
const link = document.createElement('a');
link.download = filename;
link.href = window.URL.createObjectURL(blob);
link.href = window.URL.createObjectURL(dataObjToWrite);
link.dataset.downloadurl = ['text/json', link.download, link.href].join(':');

const evt = new MouseEvent('click', {
Expand Down Expand Up @@ -174,6 +173,8 @@ const LogsPanel = ({ integration, alert }: Props) => {
};

const handleFileProgress = (progressEvent: AxiosProgressEvent) => {
// Ignore progress indicator if unsupported in browser. Some browsers ignore content-length for zipped responses.
if (progressEvent.total === undefined || progressEvent.loaded === undefined) return;
const percentComplete = Math.floor((progressEvent.loaded / Number(progressEvent.total)) * 100);
if (percentComplete !== fileProgress) {
setFileProgress(percentComplete);
Expand Down Expand Up @@ -222,11 +223,13 @@ const LogsPanel = ({ integration, alert }: Props) => {
if (err) {
// Ignore error if request cancelled
if (err.code === 'ERR_CANCELED') return;
let content = 'Error fetching logs.';
if (err?.status === 429) content = 'Too many requests';
alert.show({
variant: 'danger',
fadeOut: 10000,
closable: true,
content: err?.response?.data?.message ?? 'Error fetching logs.',
content,
});
} else {
alert.show({
Expand All @@ -235,10 +238,9 @@ const LogsPanel = ({ integration, alert }: Props) => {
closable: true,
content: result?.message ?? 'Downloaded logs.',
});
const resultJSON = await result.text();
saveTemplateAsFile(
`${integration.clientId}-${fromDate.toLocaleString()}-${toDate.toLocaleString()}.json`,
JSON.parse(resultJSON),
result.data,
);
surveyContext?.setShowSurvey(true, 'downloadLogs');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function ServiceAccountsList({
data = data || {};

const text = {
tokenUrl: `${data['auth-server-url']}/realms/${data.realm}/protocol/openid-connect/token`,
tokenUrl: `${data['token-url']}`,
clientId: `${data.resource}`,
clientSecret: `${data.credentials?.secret}`,
};
Expand Down
Loading
Loading