Skip to content

Commit

Permalink
CI/CD updates (#2)
Browse files Browse the repository at this point in the history
* removed base folder

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* ci updates

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* env.example updates

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* updated cloudbuild-pr yaml

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* updated cd stuff

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* updated firebase.json for PR build

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* fixed lint

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

* updated middleware redirect

Signed-off-by: Kial Jinnah <kialj876@gmail.com>

---------

Signed-off-by: Kial Jinnah <kialj876@gmail.com>
  • Loading branch information
kialj876 authored Jun 4, 2024
1 parent b0febfc commit 788e92d
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 98 deletions.
8 changes: 3 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Base Path Openshift: bor Firebase:
VUE_APP_PATH="/"

#vaults assets
VUE_APP_POD_NAMESPACE="local"
VUE_APP_REQUIRE_LOGIN="true"

#vaults web-url
VUE_APP_REGISTRY_URL="https://dev.bcros.ca/dashboard"
Expand All @@ -15,11 +14,10 @@ VUE_APP_AUTH_API_URL="https://auth-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_AUTH_API_VERSION="/api/v1"
VUE_APP_PAY_API_URL="https://pay-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_PAY_API_VERSION="/api/v1"
VUE_APP_LEGAL_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_LEGAL_API_VERSION_2="/api/v2"
VUE_APP_STATUS_API_URL="https://status-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_STATUS_API_VERSION="/api/v1"
VUE_APP_BOR_API_URL="https://bcregistry-dev.apigee.net/director-search"
VUE_APP_BOR_API_VERSION="/api/v1"
VUE_APP_BOR_API_KEY=

#vaults launchdarkly
VUE_APP_BTR_LD_CLIENT_ID=
Expand Down
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"root": true,
"extends": [
"@nuxtjs/eslint-config-typescript"
],
"rules": {
"max-len": [
"warn",
{ "code": 120, "ignoreRegExpLiterals": true, "ignoreTrailingComments": true }
],
"no-console": ["error", { "allow": ["warn", "error", "info"] }],
"space-before-function-paren": "off",
"vue/no-unused-vars": "warn",
"vue/multi-word-component-names": "off",
"vue/no-v-html": "off",
"@typescript-eslint/no-unused-vars": "warn"
}
}
26 changes: 12 additions & 14 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ on:
push:
branches:
- main
paths:
- "/**"
workflow_dispatch:
inputs:
environment:
description: "Environment"
required: true
type: choice
options:
- dev
- test
- sandbox
- prod
- dev
- test
- sandbox
- prod
tagname:
description: "Specify a previous version (git tag) to deploy"
required: false
Expand All @@ -25,13 +23,13 @@ on:
jobs:
bus-dash-ui-cd:
permissions:
contents: 'write'
id-token: 'write'
uses: bcgov/bcregistry-sre/.github/workflows/ui-cd-pnpm.yaml@main
contents: "write"
id-token: "write"
uses: bcgov/bcregistry-sre/.github/workflows/frontend-cd.yaml@main
with:
environment: ${{ inputs.environment }}
tagname: ${{ inputs.tagname }}
target: ${{ inputs.environment }}
node_version: 20
app_name: "business-dashboard-ui"
secrets:
APP_NAME: "business-dashboard-ui"
OP_CONNECT_URL: ${{ secrets.OP_CONNECT_URL }}
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }}
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Business Dash CI
on:
pull_request:
types: [assigned, synchronize]
paths:
- "/**"


defaults:
run:
Expand Down Expand Up @@ -72,11 +69,11 @@ jobs:
cypress-test:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [20]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -108,7 +105,7 @@ jobs:
strategy:
matrix:
node-version: [20]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -124,4 +121,3 @@ jobs:

- name: Build check
run: pnpm build

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ logs
.DS_Store
.fleet
.idea
.eslintcache

# Local env files
.env
Expand Down
14 changes: 7 additions & 7 deletions cypress/e2e/error-flows/entry-auth-error.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ context('Business Dash Auth Error Handling', () => {
})

it('should display error modal', () => {
cy.get('[data-cy="base-dialog"]').should('exist')
cy.get('[data-cy="base-dialog"]').find('h1').should('have.text', 'Business Dashboard Unavailable')
cy.get('[data-cy="base-dialog"]').find('[data-cy="base-dialog-text"]').find('p')
cy.get('[data-cy="bcros-dialog"]').should('exist')
cy.get('[data-cy="bcros-dialog"]').find('h1').should('have.text', 'Business Dashboard Unavailable')
cy.get('[data-cy="bcros-dialog"]').find('[data-cy="bcros-dialog-text"]').find('p')
.should('contain.text', 'application is currently unavailable')
cy.get('[data-cy="base-dialog"]').find('[data-cy="contact-icon"]').should('exist')
cy.get('[data-cy="base-dialog"]').find('[data-cy="contact-label"]').should('exist')
cy.get('[data-cy="base-dialog"]').find('[data-cy="contact-value"]').should('exist')
cy.get('[data-cy="base-dialog"]').find('[data-cy="base-dialog-btn"]').should('exist')
cy.get('[data-cy="bcros-dialog"]').find('[data-cy="contact-icon"]').should('exist')
cy.get('[data-cy="bcros-dialog"]').find('[data-cy="contact-label"]').should('exist')
cy.get('[data-cy="bcros-dialog"]').find('[data-cy="contact-value"]').should('exist')
cy.get('[data-cy="bcros-dialog"]').find('[data-cy="bcros-dialog-btn"]').should('exist')
})
})
51 changes: 0 additions & 51 deletions devops/cloudbuild-pr.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"hosting":
{
"site": "bcregistry-business-dashboard-dev",
"site": "business-dashboard-dev",
"public": "dist",
"ignore": ["**/devops/**", "**/.*", "**/node_modules/**"],
"rewrites": [
Expand Down
4 changes: 2 additions & 2 deletions src/app.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="bg-bcGovGray-100">
<NuxtLayout>
<base-dialog
<bcros-dialog
id="error-dialog"
attach="#appHeader"
:display="errorDisplay"
Expand All @@ -14,7 +14,7 @@
</p>
<bcros-contact-info class="font-normal font-16 mt-4" :contacts="RegistriesInfo" />
</template>
</base-dialog>
</bcros-dialog>
<div v-if="appLoading">
<UIcon
name="i-heroicons-arrow-path"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<UModal
:attach="attach || ''"
:model-value="display"
data-cy="base-dialog"
data-cy="bcros-dialog"
>
<div v-if="options" class="px-10 py-9">
<div class="flex">
<div class="grow">
<h1 data-cy="base-dialog-title">
<h1 data-cy="bcros-dialog-title">
{{ options.title }}
</h1>
</div>
Expand All @@ -16,11 +16,11 @@
color="primary"
icon="i-heroicons-x-mark-20-solid"
variant="ghost"
data-cy="base-dialog-close-btn"
data-cy="bcros-dialog-close-btn"
@click="close()"
/>
</div>
<div class="pt-9" data-cy="base-dialog-text">
<div class="pt-9" data-cy="bcros-dialog-text">
<!-- can be replaced with <template v-slot:content> -->
<slot name="content" :options="options">
<dialog-content
Expand All @@ -36,7 +36,7 @@
<div class="flex justify-center">
<div v-for="button, i in options.buttons" :key="'dialog-btn-' + i">
<slot :name="'dialog-btn-slot-' + button.slotId">
<dialog-button :button="button" data-cy="base-dialog-btn" @close="emit('close')" />
<dialog-button :button="button" data-cy="bcros-dialog-btn" @close="emit('close')" />
</slot>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/composables/useFetchBcros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const useFetchBcros = <T>(request, opts?) => {
if (!opts.headers['Account-Id']) {
opts.headers['Account-Id'] = (useBcrosAccount()).currentAccount?.id
}
if (!opts.headers['Accept']) {
opts.headers['Accept'] = 'application/json'
if (!opts.headers.Accept) {
opts.headers.Accept = 'application/json'
}

return useFetch<T>(request, opts)
Expand Down
6 changes: 5 additions & 1 deletion src/middleware/01.redirect.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import { RouteNameE } from '@/enums/route-name-e'
export default defineNuxtRouteMiddleware((to) => {
const expectedRoutes = [RouteNameE.DASHBOARD]
if (!expectedRoutes.includes(to.name as RouteNameE)) {
// TODO: remove dev/test redirects once other apps are redirecting to here properly
// set specific identifier for development (allows going directly to localhost link)
if (['local'].includes(useRuntimeConfig().public.appEnv)) {
if (['local', 'pr', 'dev'].includes(useRuntimeConfig().public.appEnv)) {
const identifier = 'BC0871427'
return navigateTo({ name: RouteNameE.DASHBOARD, params: { identifier } })
} else if (['test'].includes(useRuntimeConfig().public.appEnv)) {
const identifier = 'BC1052139'
return navigateTo({ name: RouteNameE.DASHBOARD, params: { identifier } })
} else {
useBcrosNavigate().goToBcrosDashboard()
}
Expand Down
5 changes: 4 additions & 1 deletion src/stores/business.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {

/** Return the business details for the given identifier */
async function getBusinessDetails (identifier: string, params?: object) {
return await useFetchBcros<{ business: BusinessI }>(`${apiURL}/businesses/${identifier}`, { params, dedupe: 'defer' })
return await useFetchBcros<{ business: BusinessI }>(
`${apiURL}/businesses/${identifier}`,
{ params, dedupe: 'defer' }
)
.then(({ data, error }) => {
if (error.value || !data.value) {
console.warn('Error fetching business details for', identifier)
Expand Down
3 changes: 1 addition & 2 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,5 @@ export default {
}
}
},
plugins: [],
plugins: []
}

0 comments on commit 788e92d

Please sign in to comment.