-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Informasjonsforvaltning/develop
Deploy app to production
- Loading branch information
Showing
133 changed files
with
18,609 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
tmp | ||
.vscode | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# FORMS | ||
DATAJEGER_EMAIL_ADDRESS=datajegeren.staging@norge.no | ||
FDK_MAIL_SERVICE_ENDPOINT=mail-sender-service.staging.fellesdatakatalog.digdir.no/api/sendmail | ||
FDK_MAIL_SERVICE_API_KEY= | ||
FDK_BASE_URI=https://staging.fellesdatakatalog.digdir.no | ||
FDK_COMMUNITY_BASE_URI=https://community.staging.fellesdatakatalog.digdir.no | ||
FDK_REGISTRATION_BASE_URI=https://registrering.staging.fellesdatakatalog.digdir.no | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": ["node_modules", "**/*"], | ||
"plugins": ["@nx"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"extends": [ | ||
"plugin:import/recommended", | ||
"plugin:@nx/typescript", | ||
"plugin:@typescript-eslint/eslint-plugin/recommended", | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"import/no-unresolved": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"no-console": "off", | ||
"no-restricted-syntax": [ | ||
"error", | ||
{ | ||
"selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(error)$/]", | ||
"message": "Unexpected property on console object was called" | ||
} | ||
], | ||
"no-duplicate-imports": "error", | ||
"arrow-body-style": ["warn", "as-needed"], | ||
"require-atomic-updates": "error", | ||
"no-use-before-define": "error", | ||
"no-unreachable-loop": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-promise-executor-return": "error", | ||
"no-await-in-loop": "error", | ||
"camelcase": "error", | ||
"complexity": ["warn", 10], | ||
"consistent-return": "warn", | ||
"curly": "warn", | ||
"default-case": "error", | ||
"default-case-last": "error", | ||
"default-param-last": "error", | ||
"eqeqeq": ["error", "smart"], | ||
"func-style": ["error", "expression", { "allowArrowFunctions": true }], | ||
"max-depth": ["warn", 4], | ||
"max-lines": ["warn", 300], | ||
"no-alert": "warn", | ||
"no-empty-function": "warn", | ||
"no-eq-null": "error", | ||
"no-implicit-coercion": "warn", | ||
"no-magic-numbers": ["warn", { "ignoreArrayIndexes": true }], | ||
"no-param-reassign": "error", | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": "error", | ||
"prefer-const": "error", | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": "error" | ||
} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"extends": [ | ||
"plugin:import/recommended", | ||
"plugin:@nx/javascript", | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"react/react-in-jsx-scope": "off", | ||
"no-console": "warn", | ||
"no-duplicate-imports": "error", | ||
"arrow-body-style": ["warn", "as-needed"], | ||
"require-atomic-updates": "error", | ||
"no-use-before-define": "error", | ||
"no-unreachable-loop": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-promise-executor-return": "error", | ||
"no-await-in-loop": "error", | ||
"camelcase": "error", | ||
"complexity": ["warn", 10], | ||
"consistent-return": "warn", | ||
"curly": "warn", | ||
"default-case": "error", | ||
"default-case-last": "error", | ||
"default-param-last": "error", | ||
"eqeqeq": ["error", "smart"], | ||
"func-style": ["error", "expression", { "allowArrowFunctions": true }], | ||
"max-depth": ["warn", 4], | ||
"max-lines": ["warn", 300], | ||
"no-alert": "warn", | ||
"no-empty-function": "warn", | ||
"no-eq-null": "error", | ||
"no-implicit-coercion": "warn", | ||
"no-magic-numbers": ["warn", { "ignoreArrayIndexes": true }], | ||
"no-param-reassign": "error", | ||
"no-shadow": "error", | ||
"prefer-const": "error" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Bug rapport | ||
about: Lag en bug rapport | ||
title: '[Bug]: kort beskrivelse av problemet' | ||
labels: 'bug' | ||
--- | ||
|
||
## 🐛 Bug rapport | ||
|
||
### Nåværende oppførsel | ||
|
||
### Forventet oppførsel | ||
|
||
### Hvordan reprodusere? | ||
|
||
### Forslag/Løsning [Valgfritt] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Feature forespørsel | ||
about: Forespør en ny feature | ||
title: '[Feat]: kort beskrivelse av feature' | ||
labels: 'enhancement' | ||
--- | ||
|
||
## 🚀 Feature forespørsel | ||
|
||
### Feature beskrivelse | ||
|
||
### Hvorfor trenger vi det? | ||
|
||
### Forslag/løsning [Valgfritt] | ||
|
||
### Definisjon av ferdig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: UX issue | ||
about: Lag et UX issue | ||
title: '[UX]: kort beskrivelse av problemet' | ||
labels: 'ux' | ||
--- | ||
|
||
## 🪄 UX rapport | ||
|
||
### Nåværende oppførsel | ||
|
||
### Dette er et problem fordi: | ||
|
||
### Forventet oppførsel/ønsket oppførsel | ||
|
||
### Skjermbilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Code scanning (CodeQL) | ||
|
||
on: | ||
pull_request: | ||
types: [ready_for_review, opened, reopened, synchronize] | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 2 * * *' | ||
|
||
jobs: | ||
codeql: | ||
name: Run codeql scan | ||
if: github.event.pull_request.draft == false | ||
uses: Informasjonsforvaltning/workflows/.github/workflows/codeql.yaml@main | ||
with: | ||
language: javascript | ||
secrets: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Deploy to production and demo | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Test and build | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
changed: ${{ steps.set-matrix.outputs.changed }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# We need to fetch all branches and commits so that Nx affected has a base to compare against. | ||
fetch-depth: 0 | ||
|
||
- name: Set SHAs | ||
uses: nrwl/nx-set-shas@v4 | ||
|
||
- name: Enable corepack | ||
run: corepack enable | ||
|
||
- name: Use Node.js 20.9.0 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.9.0 | ||
cache: 'yarn' | ||
|
||
- name: Yarn install | ||
run: | | ||
corepack enable | ||
yarn set version stable | ||
yarn install --frozen-lockfile | ||
- name: Caching Nx | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules/.cache | ||
key: cache-nx-${{ hashFiles('yarn.lock') }} | ||
|
||
- id: set-matrix | ||
run: | | ||
echo "matrix={\"appname\":$(yarn --silent run matrix)}" >> $GITHUB_OUTPUT | ||
echo "changed=$(yarn --silent run matrix)" >> $GITHUB_OUTPUT | ||
- run: yarn run affected:lint --parallel=2 | ||
- run: yarn run affected:test --parallel=2 --configuration=ci | ||
- run: yarn run affected:e2e --parallel=2 --configuration=ci | ||
- run: yarn run affected:build --parallel=2 --configuration=ci | ||
|
||
- name: Caching Dist Folder | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./dist | ||
key: cache-dist-${{ github.sha }} | ||
|
||
build: | ||
name: Build affected apps when pull request is created | ||
needs: [test] | ||
if: ${{ needs.test.outputs.changed != '[]' }} | ||
strategy: | ||
matrix: ${{fromJSON(needs.test.outputs.matrix)}} | ||
uses: Informasjonsforvaltning/workflows/.github/workflows/build-push.yaml@main | ||
with: | ||
app_name: ${{ matrix.appname }}-frontend | ||
environment: prod | ||
build_env: true | ||
build_env_name: BINARY | ||
build_env_value: ${{ matrix.appname }}-frontend | ||
cache_path: ./dist | ||
cache_key: cache-dist-${{ github.sha }} | ||
dockerfile: apps/${{ matrix.appname }}/Dockerfile | ||
secrets: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GCP_SA_DIGDIR_FDK_GCR_KEY: ${{ secrets.GCP_SA_DIGDIR_FDK_GCR_KEY }} | ||
|
||
deploy-prod: | ||
name: Deploy affected apps to production environment with reusable workflow | ||
needs: [test, build] | ||
strategy: | ||
matrix: ${{fromJSON(needs.test.outputs.matrix)}} | ||
fail-fast: false | ||
if: ${{ needs.test.outputs.changed != '[]' }} | ||
uses: Informasjonsforvaltning/workflows/.github/workflows/kustomize-deploy.yaml@main | ||
with: | ||
app_name: ${{ matrix.appname }}-frontend | ||
environment: prod | ||
monorepo_app: true | ||
cluster: digdir-fdk-prod | ||
secrets: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DIGDIR_FDK_AUTODEPLOY: ${{ secrets.DIGDIR_FDK_PROD_AUTODEPLOY }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
deploy-demo: | ||
name: Deploy affected apps to demo environment with reusable workflow | ||
needs: [test, deploy-prod] | ||
strategy: | ||
matrix: ${{fromJSON(needs.test.outputs.matrix)}} | ||
fail-fast: false | ||
if: ${{ needs.test.outputs.changed != '[]' }} | ||
uses: Informasjonsforvaltning/workflows/.github/workflows/kustomize-deploy.yaml@main | ||
with: | ||
app_name: ${{ matrix.appname }}-frontend | ||
environment: demo | ||
monorepo_app: true | ||
cluster: digdir-fdk-dev | ||
secrets: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DIGDIR_FDK_AUTODEPLOY: ${{ secrets.DIGDIR_FDK_DEV_AUTODEPLOY }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
Oops, something went wrong.