Skip to content

Commit 8462e9a

Browse files
authoredFeb 27, 2025
Standarisering av github workflows og nais-config (#1523)
* Bruk .yaml i stedet for .yml * Erstatt workflows med nye som bruker templates * Legg til yarn script for validering * Rename nais-filer * Standariser mappestruktur for nais-filer * Bruk kebab-case i stedet for snake-case * Fjern skip-cypress input, brukes ikke * Legg til workflow_dispatch trigger på main * Splitt deploy workflows, fiks permissions og kun deploy til prod fra main. * Fjern image opprydning, ikke lengre aktuell * Send base-path direkte Å sende env som param er ikke støttet * Sett base_path i nais-fil, ikke workflow. * Sett riktig param navn for image-tag * Revert "Sett base_path i nais-fil, ikke workflow." This reverts commit af02360.
1 parent c6811df commit 8462e9a

15 files changed

+166
-110
lines changed
 
File renamed without changes.
File renamed without changes.

‎.github/workflows/build_n_deploy_dev.yaml

-76
This file was deleted.

‎.github/workflows/delete_images.yml

-23
This file was deleted.

‎.github/workflows/deploy-unleash-api-token.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
env:
1515
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
1616
CLUSTER: dev-gcp
17-
RESOURCE: build_n_deploy/naiserator/unleash/unleash-apitoken-dev.yaml
17+
RESOURCE: .nais/unleash/unleash-apitoken-dev.yaml
1818
deploy-prod:
1919
runs-on: ubuntu-latest
2020
steps:
@@ -25,4 +25,4 @@ jobs:
2525
env:
2626
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
2727
CLUSTER: prod-gcp
28-
RESOURCE: build_n_deploy/naiserator/unleash/unleash-apitoken-prod.yaml
28+
RESOURCE: .nais/unleash/unleash-apitoken-prod.yaml

‎.github/workflows/build_n_deploy_prod.yaml ‎.github/workflows/gammel-build-n-deploy-prod.yaml

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
name: Build, push, and deploy app to prod
1+
name: Gammel Build, push, and deploy app to prod
22

33
on:
44
workflow_dispatch:
5-
branches:
6-
- main
7-
push:
8-
branches:
9-
- 'main'
105

116
env:
127
BASE_PATH: /barnetrygd/soknad/
@@ -76,7 +71,7 @@ jobs:
7671
uses: nais/deploy/actions/deploy@v2
7772
env:
7873
CLUSTER: dev-gcp
79-
RESOURCE: build_n_deploy/naiserator/naiserator_dev.yaml
74+
RESOURCE: .nais/app-dev.yaml
8075
VAR: base_path=${{ env.BASE_PATH }}
8176
IMAGE: ${{ needs.bygg.outputs.image }}
8277

@@ -95,6 +90,6 @@ jobs:
9590
uses: nais/deploy/actions/deploy@v2
9691
env:
9792
CLUSTER: prod-gcp
98-
RESOURCE: build_n_deploy/naiserator/naiserator_prod.yaml
93+
RESOURCE: .nais/app-prod.yaml
9994
VAR: base_path=${{ env.BASE_PATH }}
10095
IMAGE: ${{ needs.bygg.outputs.image }}

‎.github/workflows/main.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Full pipeline on push to main. Build, test, and deploy to dev + prod
2+
name: Main
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'main'
8+
paths-ignore:
9+
- '**.md'
10+
- '**.MD'
11+
- '.github/*.yaml'
12+
- '.gitignore'
13+
- '.prettierignore'
14+
- '.prettierrc'
15+
- 'CODEOWNERS'
16+
- 'LICENSE'
17+
- 'eslint.config.mjs'
18+
- '.husky/**'
19+
20+
jobs:
21+
build:
22+
name: Build
23+
if: github.ref == 'refs/heads/main' # Only deploy to prod from main branch
24+
permissions:
25+
contents: read
26+
id-token: write
27+
uses: navikt/familie-baks-gha-workflows/.github/workflows/build-yarn-app.yaml@main
28+
with:
29+
build-image: true
30+
push-image: true
31+
base-path: /barnetrygd/soknad/
32+
secrets: inherit
33+
deploy-dev:
34+
name: Deploy dev
35+
permissions:
36+
id-token: write
37+
needs: [ build ]
38+
uses: navikt/familie-baks-gha-workflows/.github/workflows/deploy.yaml@main
39+
with:
40+
image: ${{ needs.build.outputs.image }}
41+
cluster: dev-gcp
42+
resource: .nais/app-dev.yaml
43+
secrets: inherit
44+
deploy-prod:
45+
name: Deploy prod
46+
permissions:
47+
id-token: write
48+
needs: [ build, deploy-dev ]
49+
uses: navikt/familie-baks-gha-workflows/.github/workflows/deploy.yaml@main
50+
with:
51+
image: ${{ needs.build.outputs.image }}
52+
cluster: prod-gcp
53+
resource: .nais/app-prod.yaml
54+
secrets: inherit
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Manual deploy to dev
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
skip-tests:
6+
description: 'Skip tests?'
7+
default: false
8+
type: boolean
9+
skip-validation:
10+
description: 'Skip validation? (eslint, prettier, typecheck)'
11+
default: false
12+
type: boolean
13+
14+
jobs:
15+
build:
16+
name: Build
17+
permissions:
18+
contents: read
19+
id-token: write
20+
uses: navikt/familie-baks-gha-workflows/.github/workflows/build-yarn-app.yaml@main
21+
with:
22+
build-image: true
23+
push-image: true
24+
skip-tests: ${{ inputs.skip-tests }}
25+
skip-validation: ${{ inputs.skip-validation }}
26+
base-path: /barnetrygd/soknad/
27+
secrets: inherit
28+
deploy-with-new-image:
29+
name: Deploy with new image
30+
permissions:
31+
id-token: write
32+
needs: [ build ]
33+
uses: navikt/familie-baks-gha-workflows/.github/workflows/deploy.yaml@main
34+
with:
35+
image: ${{ needs.build.outputs.image }}
36+
cluster: dev-gcp
37+
resource: .nais/app-dev.yaml
38+
secrets: inherit
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Manual deploy to prod (from main)
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
skip-tests:
6+
description: 'Skip tests?'
7+
default: false
8+
type: boolean
9+
skip-validation:
10+
description: 'Skip validation? (eslint, prettier, typecheck)'
11+
default: false
12+
type: boolean
13+
14+
jobs:
15+
build:
16+
name: Build
17+
if: github.ref == 'refs/heads/main' # Only deploy to prod from main branch
18+
permissions:
19+
contents: read
20+
id-token: write
21+
uses: navikt/familie-baks-gha-workflows/.github/workflows/build-yarn-app.yaml@main
22+
with:
23+
build-image: true
24+
push-image: true
25+
skip-tests: ${{ inputs.skip-tests }}
26+
skip-validation: ${{ inputs.skip-validation }}
27+
base-path: /barnetrygd/soknad/
28+
secrets: inherit
29+
deploy-with-new-image:
30+
name: Deploy with new image
31+
permissions:
32+
id-token: write
33+
needs: [ build ]
34+
uses: navikt/familie-baks-gha-workflows/.github/workflows/deploy.yaml@main
35+
with:
36+
image: ${{ needs.build.outputs.image }}
37+
cluster: prod-gcp
38+
resource: .nais/app-prod.yaml
39+
secrets: inherit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Manual deploy with image
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
environment:
6+
description: "Environment to deploy to"
7+
required: true
8+
type: choice
9+
options:
10+
- dev
11+
- prod
12+
image:
13+
required: true
14+
type: string
15+
description: 'Image tag to deploy (ex: 2025.02.14-14.40-70a41ds)'
16+
jobs:
17+
deploy-with-existing-image:
18+
name: Deploy with existing image
19+
if: inputs.image != ''
20+
permissions:
21+
id-token: write
22+
uses: navikt/familie-baks-gha-workflows/.github/workflows/deploy-with-tag.yaml@main
23+
with:
24+
image-tag: ${{ inputs.image }}
25+
cluster: ${{ inputs.environment }}-gcp
26+
resource: .nais/app-${{ inputs.environment }}.yaml
27+
secrets: inherit
File renamed without changes.
File renamed without changes.

‎package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"format-all": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
66
"prettier": "prettier -l \"src/**/*.{js,jsx,ts,tsx}\"",
77
"eslint": "eslint src/",
8+
"lint": "eslint src/",
89
"lint-test": "yarn prettier && yarn eslint",
910
"start:dev": "yarn clean && BASE_PATH=/barnetrygd/soknad/ concurrently \"yarn:dev:*\"",
1011
"dev:server": "yarn build:backend:dev && node dist/server.cjs",
@@ -21,7 +22,8 @@
2122
"texts:find-unused": "python3 src/scripts/finn-ubrukte-språktekster.py",
2223
"texts:find-missing": "node src/scripts/find-missing-text-ids.js",
2324
"texts:cleanup": "src/scripts/formater-tekster.sh src/frontend/assets/lang",
24-
"prepare": "husky"
25+
"prepare": "husky",
26+
"validate": "yarn typecheck && yarn lint && yarn prettier"
2527
},
2628
"jest": {
2729
"roots": [

0 commit comments

Comments
 (0)
Please sign in to comment.