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

Release Login Refresh Shared IdP Org Assignment #670

Merged
merged 38 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
90fe495
upd footer routes; add component for page layout; add about-us and pr…
jTendeck Oct 20, 2022
95bc83c
add remaining pages
jTendeck Oct 25, 2022
d35812b
cleanup markdown
jTendeck Oct 25, 2022
3beb553
move content to /content
jTendeck Oct 25, 2022
47b982d
add /content to skip-auth-regex in ci-build-deploy wf
jTendeck Oct 26, 2022
11ebe00
rm dates
jTendeck Oct 26, 2022
1137908
add margin to h1
jTendeck Oct 26, 2022
aef4059
upd about us first para
jTendeck Oct 26, 2022
6a7d115
hide tos link; revert to disclaimer link
jTendeck Oct 26, 2022
cf80f1a
upd page class names
jTendeck Oct 26, 2022
3f44444
minor tweaks
jTendeck Oct 26, 2022
fa9f746
add contact page
jTendeck Oct 26, 2022
5ff91c9
upd markdown a tag style
jTendeck Oct 26, 2022
bd6ff00
more md styles upd
jTendeck Oct 26, 2022
da83011
add in links to content
jTendeck Oct 26, 2022
8553842
add markdown using next functionality
jTendeck Oct 28, 2022
e1d79b5
Render markdown content pages use servers side props and react-markdown
Jonesy Oct 28, 2022
ec46af8
Fix some ts errors, remove date and unused code
Jonesy Oct 28, 2022
35e7728
fix some issues
jTendeck Oct 29, 2022
9648729
fix 404 redirect
jTendeck Oct 31, 2022
8cce25a
rm footer-pages component
jTendeck Oct 31, 2022
36ba751
restore docs.module.css
jTendeck Oct 31, 2022
c4530c8
rm chakra link from _app
jTendeck Oct 31, 2022
56c7be1
fix next links
jTendeck Nov 1, 2022
df62200
Merge pull request #617 from bcgov/feature/footer-pages
jTendeck Nov 2, 2022
07dd5f8
Update README.md
jTendeck Nov 16, 2022
9a36df9
Service Accounts UI Refresh (#600)
Jonesy Nov 22, 2022
622c708
Feature/gateway services (#630)
Jonesy Nov 22, 2022
4798927
Feature/gateway services cypress (#628)
nirajCITZ Nov 23, 2022
d3255bb
Hot fix portal feeder from ckan (#640)
ikethecoder Nov 24, 2022
03a2658
Hotfix/gw services (#647)
ikethecoder Nov 25, 2022
ad59e33
update mongodb version
jTendeck Dec 1, 2022
d453301
Merge branch 'dev' of https://github.com/bcgov/api-services-portal in…
jTendeck Dec 1, 2022
00232e2
Feature Shared IdP (#641)
ikethecoder Dec 29, 2022
6b47f16
Minor UI fixes (Sprint 58-59) (#637)
Jonesy Dec 29, 2022
8469e8a
Feature Organizational Access (#657)
ikethecoder Dec 30, 2022
1aeaf03
Login refresh (#650)
Jonesy Dec 30, 2022
5c70ade
Hotfixes SP62 (#669)
ikethecoder Dec 30, 2022
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
20 changes: 15 additions & 5 deletions .github/workflows/ci-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
image:
registry: docker.pkg.github.com
repository: bcgov-dss/api-serv-infra/mongodb
tag: 4.4-ea993071
tag: 5.0-7a639fba
pullPolicy: IfNotPresent
pullSecrets:
- dev-github-read-packages-creds
Expand All @@ -111,8 +111,18 @@ jobs:
rbac:
create: true

strategyType: Recreate

updateStrategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 100%

readinessProbe:
timeoutSeconds: 20

livenessProbe:
timeoutSeconds: 20

persistence:
enabled: true
size: 2Gi
Expand All @@ -134,7 +144,7 @@ jobs:
runAsUser: ${{ secrets.RUNNING_UID_GID }}
' > values.yaml
helm repo add bitnami https://charts.bitnami.com/bitnami
helm upgrade --install proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-db --version 10.31.5 -f values.yaml bitnami/mongodb
helm upgrade --install proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-db --version 12.1.31 -f values.yaml bitnami/mongodb

- name: 'Deploy Backend'
if: github.ref != 'refs/heads/dev'
Expand Down Expand Up @@ -188,7 +198,7 @@ jobs:
client-secret: ${{ secrets.OIDC_CLIENT_SECRET }}
oidc-issuer-url: ${{ secrets.OIDC_ISSUER }}
redirect-url: https://api-services-portal-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}.apps.silver.devops.gov.bc.ca/oauth2/callback
skip-auth-regex: '/login|/health|/public|/docs|/redirect|/_next|/images|/devportal|/manager|/about|/maintenance|/admin/session|/ds/api|/feed/|/signout|^[/]$'
skip-auth-regex: '/login|/health|/public|/docs|/redirect|/_next|/images|/devportal|/manager|/about|/maintenance|/admin/session|/ds/api|/feed/|/signout|/content|^[/]$'
whitelist-domain: authz-apps-gov-bc-ca.dev.api.gov.bc.ca
skip-provider-button: 'true'
profile-url: ${{ secrets.OIDC_ISSUER }}/protocol/openid-connect/userinfo
Expand Down
54 changes: 40 additions & 14 deletions .github/workflows/ci-build-only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Deploy Refactor

on:
push:
branches: [NEVER]
branches: [hotfix/*]

env:
REGISTRY: ghcr.io
Expand All @@ -15,6 +15,28 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/bcgov/api-services-portal/api-services-portal

- name: Docker meta Feeder
id: docker_meta_feeder
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/bcgov/api-services-portal/data-feeder

- name: Set DEPLOY_ID which will deploy a custom deploy to 'dev' environment
run: |
echo '::set-output name=DEPLOY_ID::${{ steps.docker_meta.outputs.version }}'
echo '::set-output name=APP_VERSION::${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}'
echo '::set-output name=APP_REVISION::${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.revision'] }}'
id: set-deploy-id

- name: Get deploy ID
run: echo "The DEPLOY_ID is ${{ steps.set-deploy-id.outputs.DEPLOY_ID }}"

- uses: actions/checkout@v2

- name: Login to DockerHub
Expand All @@ -35,27 +57,31 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1

- id: release
uses: rymndhng/release-on-push-action@v0.15.0
- name: Build Feeder
uses: docker/build-push-action@v2
with:
bump_version_scheme: patch

- name: Check Output Parameters
run: |
echo "Got tag name ${{ steps.release.outputs.tag_name }}"
echo "Got release version ${{ steps.release.outputs.version }}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
context: feeds
file: feeds/Dockerfile
tags: ${{ steps.docker_meta_feeder.outputs.tags }}
push: true
build-args: |
GITHUB_API_TOKEN=${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
APP_VERSION=${{ steps.set-deploy-id.outputs.APP_VERSION }}
APP_REVISION=${{ steps.set-deploy-id.outputs.APP_REVISION }}

- name: Build
- name: Build Portal
uses: docker/build-push-action@v2
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
context: .
file: Dockerfile
tags: ${{ steps.release.outputs.tag_name }}
load: true
tags: ${{ steps.docker_meta.outputs.tags }}
push: true
build-args: |
GITHUB_API_TOKEN=${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
APP_VERSION=${{ steps.set-deploy-id.outputs.APP_VERSION }}
APP_REVISION=${{ steps.set-deploy-id.outputs.APP_REVISION }}

- name: Push
run: docker push ${{ steps.release.outputs.tag_name }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,4 @@ select 'drop table "' || tablename || '" cascade;' from pg_tables where schemana
```

In the mean time, it is possible to drop the tables and re-run the `init-aps-portal-keystonejs-batch-job`.

85 changes: 85 additions & 0 deletions e2e/cypress/pageObjects/gatewayService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
class GatewayServicePage {

path: string = '/manager/services'
userNameInput: string = '[data-testid="nsa-gua-email-field"]'
grantUserAccessBtn: string = '[data-testid="nsa-grant-access-btn"]'
serviceTable: string = '[data-testid="matrixDetailsTable"]'
clearAllFilterBtn: string = '[data-testid="btn-filter-clear-all"]'
filterType: string = '[data-testid="filter-type-select"]'
filterValue: string = '[data-testid="consumer-filters-select"]'
filterApplyBtn: string = '[data-testid="btn-filter-apply"]'

getTestIdEnvName(env: string): string {
switch (env) {
case "Development":
return "dev"
case "Production":
return "prod"
default:
return env.toLowerCase()
}
}

expandServiceDetails(productName: string, envName: string) {
let pname: string = productName.toLowerCase().replaceAll(' ', '-')
let env = this.getTestIdEnvName(envName);
cy.get(`[data-testid=${pname}-${env}-metrics-details]`).click()
}

verifyRequestCount(productName: string, envName: string, count: number) {
let pname: string = productName.toLowerCase().replaceAll(' ', '-')
let env = this.getTestIdEnvName(envName);
cy.get(`[data-testid=${pname}-${env}-totalRequest]`).then(($value) => {
let countValue = $value.text()
assert.equal(countValue, count.toString())
})
}

verifyHostName(hostName: string) {
cy.contains('Host').next('dd').then(($value) => {
let hostValue = $value.text()
assert.equal(hostValue, hostName)
})
}

verifyTagsName(tagsName: string) {
cy.contains('Tags').next('dd').find('span').then(($value) => {
let hostValue = $value.text()
assert.equal(hostValue, tagsName)
})
}

verifyRouteName(service: string, route: string) {
cy.get(`[data-testid^=${service}-service-details`).then(($value) => {
let routeValue = $value.text()
debugger
assert.equal(routeValue, route)
})
}

verifyFilterResultsForGatewayService(filterType: string, filterValue: string, expectedResult: string, labelValue?: any) {
cy.wait(2000)
this.filterGatewayServiceByTypeAndValue(filterType, filterValue)
cy.wait(2000)
cy.get(this.serviceTable).find("tbody").find("tr").then((row) => {
expect(row.length.toString()).eq(expectedResult)
if (filterType === 'Environment') {
let environment = row.find('td:nth-child(2)').find('span').text()
assert.equal(environment,filterValue)
}
})

}

filterGatewayServiceByTypeAndValue(type: string, value: string) {
cy.get("body").then($body => {
if ($body.find(this.clearAllFilterBtn).length > 0) {
cy.get(this.clearAllFilterBtn, { timeout: 2000 }).click()
}
});
cy.get(this.filterType).select(type).invoke('val')
cy.get(this.filterValue).select(value).invoke('val')
cy.get(this.filterApplyBtn).click()
}
}
export default GatewayServicePage
6 changes: 1 addition & 5 deletions e2e/cypress/pageObjects/namespaceAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ class NamespaceAccessPage {
})
})
cy.contains("Share").click()
cy.wait(2000)
}

revokePermission(revokePermission: any) {
let accessRole: Array<string> = revokePermission.accessRole
accessRole.forEach(function (accessName) {
// cy.contains(revokePermission.userName).parents('tr').find('td:nth-child(2)').each(($e1, index, $list) => {
cy.contains(revokePermission.userName).parents('tr').find('td:nth-child(2)').find('span').each(($e1, index, $list) => {
cy.contains(revokePermission.userName).parents('tr').find('td:nth-child(2)').find('span').each(($e1, index, $list) => {
const text = $e1.text()
if (text === accessName) {
cy.wrap($e1).find('button').click()
Expand All @@ -38,15 +36,13 @@ class NamespaceAccessPage {
{
cy.contains(user).parents('tr').find('td:nth-child(3)').children('button').click()
cy.get('[data-testid$="-revoke-btn"]').filter(':visible').first().click()
cy.wait(2000)
}

path: string = '/manager/namespace-access'

clickGrantUserAccessButton() {
cy.get('[data-testid="nsa-users-table-row-0-menu"]',{ timeout: 5000 }).should('be.visible');
cy.get(this.grantUserAccessBtn).first().click({force:true})
cy.wait(2000)
}
}
export default NamespaceAccessPage
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import ApiDirectoryPage from '../../pageObjects/apiDirectory'
import GatewayServicePage from '../../pageObjects/gatewayService'
import HomePage from '../../pageObjects/home'
import LoginPage from '../../pageObjects/login'
import MyAccessPage from '../../pageObjects/myAccess'
import NamespaceAccessPage from '../../pageObjects/namespaceAccess'

describe('Verify Gateway Service details', () => {
const login = new LoginPage()
const apiDir = new ApiDirectoryPage()
const myAccessPage = new MyAccessPage()
const home = new HomePage()
const na = new NamespaceAccessPage()
const gs = new GatewayServicePage()

before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('apiowner').as('apiowner')
})

it('authenticates Janis (api owner)', () => {
cy.get('@apiowner').then(({ user, namespace }: any) => {
cy.login(user.credentials.username, user.credentials.password)
cy.log('Logged in!')
home.useNamespace(namespace)
})
})

it('Navigate to Gateway Service Page', () => {
cy.intercept('POST', '/gql/api').as('createBoard')
cy.visit(gs.path)
cy.wait(2000)
})

it('Expand Gateway service details pane', () => {
cy.get('@apiowner').then(({ product }: any) => {
gs.expandServiceDetails(product.environment.config.serviceName, product.environment.name)
})
})

it('Verify total requests counts', () => {
cy.get('@apiowner').then(({ product }: any) => {
gs.verifyRequestCount(product.environment.config.serviceName, product.environment.name, 0)
})
})

it('Verify the routes details ', () => {
cy.get('@apiowner').then(({ product }: any) => {
gs.verifyRouteName(product.environment.config.serviceName, 'https://a-service-for-newplatform.api.gov.bc.ca/')
})
})

it('Verify the host details ', () => {
gs.verifyHostName('httpbin.org')
})

it('Verify the Tags details ', () => {
gs.verifyTagsName('ns.newplatform')
})

after(() => {
cy.logout()
cy.clearLocalStorage({ log: true })
cy.deleteAllCookies()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import ConsumersPage from '../../pageObjects/consumers'
import LoginPage from '../../pageObjects/login'
import HomePage from '../../pageObjects/home'
import ProductPage from '../../pageObjects/products'
import GatewayServicePage from '../../pageObjects/gatewayService'

describe('Filter Gateway Services Spec', () => {
const login = new LoginPage()
const consumers = new ConsumersPage()
const home = new HomePage()
const gs = new GatewayServicePage()

before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('apiowner').as('apiowner')
})

it('authenticates Janis (api owner)', () => {
cy.get('@apiowner').then(({ user, namespace }: any) => {
cy.login(user.credentials.username, user.credentials.password)
cy.log('Logged in!')
home.useNamespace(namespace)
})
})

it('Navigate to Gateway Service Page', () => {
cy.visit(gs.path)
cy.wait(2000)
})

it('verify that Gateway service filters as per given parameter', () => {
cy.get('@apiowner').then(({ product }: any) => {
gs.verifyFilterResultsForGatewayService('Products', product.name, '2')
gs.verifyFilterResultsForGatewayService('Environment', product.environment.name, '1')
gs.verifyFilterResultsForGatewayService('Environment', product.test_environment.name, '1')
})
})
})
Loading