Skip to content

Commit

Permalink
merge main into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
framitdavid committed Jul 15, 2024
2 parents 531da2f + c89baa5 commit ea09e32
Show file tree
Hide file tree
Showing 47 changed files with 1,816 additions and 685 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/helm-chart-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Eid logger helm build and push
on:
push:
branches: [ main ]
paths:
- 'eidlogger/**'
- '.github/workflows/helm-chart-push.yaml'
- 'charts/eid-logger/**'
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
helm-build-push:
name: Helm build and push
runs-on: ubuntu-latest
env:
REGISTRY: altinntjenestercontainerregistry.azurecr.io
REPOSITORY: eid-logger
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID_FC }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID_FC }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: 'Azure login'
uses: azure/login@v2
with:
client-id: ${{ env.AZURE_CLIENT_ID }}
tenant-id: ${{ env.AZURE_TENANT_ID }}
subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}

- name: 'Install helm'
uses: azure/[email protected]
with:
version: '3.15.3'
id: install

- name: Log in to Container registry
run: |
az acr login --name ${{ env.REGISTRY }} --expose-token --output tsv --query accessToken --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }} --only-show-errors | helm registry login ${{ env.REGISTRY }} --username 00000000-0000-0000-0000-000000000000 --password-stdin
- name: Helm build
run: |
helm package charts/eid-logger --version 0.1.0+${{ github.sha }}
- name: Helm push
run: |
helm push eid-logger-0.1.0+${{ github.sha }}.tgz oci://${{ env.REGISTRY }}/charts
72 changes: 72 additions & 0 deletions .github/workflows/playwright-resourceadm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Resourceadm Playwright Tests in Dev

on:
push:
branches:
- main
paths:
- 'frontend/resourceadm/**'
- '.github/workflows/playwright-resourceadm.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
playwright-run:
name: 'Resourceadm Playwright Tests'
runs-on: ubuntu-latest

steps:
- name: 'Checking Out Code'
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
cache: 'yarn'

- name: Get yarn cache directory path
working-directory: frontend
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Attempt to wait for deploy to environment (15 minutes sleep)
run: |
if [ "${{ github.run_attempt }}" != "1" ]; then
echo "Skip waiting for deploy, since this is a re-run of the pipeline."
else
sleep 15m
fi
- name: Resourceadm Playwright run
working-directory: frontend/resourceadm/testing/playwright
env:
PLAYWRIGHT_TEST_BASE_URL: 'https://dev.altinn.studio'
PLAYWRIGHT_RESOURCES_ORGANIZATION: ttd
PLAYWRIGHT_RESOURCES_REPO_NAME: ttd-resources
PLAYWRIGHT_USER: 'AutoTest'
PLAYWRIGHT_PASS: ${{ secrets.AUTO_TEST_USER_PWD }}
GITEA_ACCESS_TOKEN: ${{ secrets.AUTO_TEST_USER_TOKEN_DEV }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn
yarn install --immutable --inline-builds
yarn playwright install --with-deps
yarn resourceadm:playwright:test:all
- name: Store artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-resourceadm-screenshots
path: frontend/resourceadm/testing/playwright/test-results
71 changes: 71 additions & 0 deletions .github/workflows/run-playwright-resourceadm-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Resource admin playwright tests on pr
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
paths:
- 'frontend/resourceadm/**'
- '.github/workflows/run-playwright-resourceadm-on-pr.yaml'
workflow_dispatch:

jobs:
playwright-tests:
name: Build environment and run e2e test
timeout-minutes: 25
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate .env file
run: |
echo PLAYWRIGHT_TEST_APP=autodeploy-v3 >> .env
echo DEVELOP_APP_DEVELOPMENT=0 >> .env
echo DEVELOP_RESOURCE_ADMIN=0 >> .env
echo DEVELOP_BACKEND=0 >> .env
echo DEVELOP_DASHBOARD=0 >> .env
echo DEVELOP_PREVIEW=0 >> .env
echo GITEA_ADMIN_PASS=g9wDIG@6gf >> .env
echo GITEA_ADMIN_USER=localg1iteaadmin >> .env
echo GITEA_CYPRESS_USER=cypress_testuser >> .env
echo GITEA_CYPRESS_PASS=g9wDIG@6gf >> .env
echo GITEA_ORG_USER=ttd >> .env
echo POSTGRES_PASSWORD=kyeDIG@eip >> .env
echo COMMIT= >> .env
echo IGNORE_DOCKER_DNS_LOOKUP=true >> .env
- name: Build all images
run: |
docker compose build --no-cache
- name: Install node
uses: actions/setup-node@v4
with:
cache: 'yarn'

- name: Run setup.js script
run: |
node ./development/setup.js
- name: Playwright resourceadm run
working-directory: frontend/resourceadm/testing/playwright
env:
environment: local
run: |
yarn
yarn playwright install --with-deps
yarn resourceadm:setup:playwright
yarn resourceadm:playwright:test:all
- name: Stop compose file
if: always()
run: docker-compose down

- name: Store artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-resourceadm-screenshots
path: frontend/testing/playwright/test-results
22 changes: 11 additions & 11 deletions backend/packagegroups/NuGet.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<ItemGroup Label="Altinn specific packages">
<PackageReference Update="Altinn.App.Core" Version="8.0.0-rc1" />
<PackageReference Update="Altinn.Common.AccessToken" Version="4.4.3" />
<PackageReference Update="Altinn.Common.AccessTokenClient" Version="3.0.4" />
<PackageReference Update="Altinn.Platform.Storage.Interface" Version="3.29.0" />
<PackageReference Update="Altinn.Common.AccessToken" Version="4.4.4" />
<PackageReference Update="Altinn.Common.AccessTokenClient" Version="3.0.5" />
<PackageReference Update="Altinn.Platform.Storage.Interface" Version="3.30.0" />
</ItemGroup>

<ItemGroup Label="Shared nuget packages">
Expand All @@ -19,17 +19,17 @@
<PackageReference Update="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageReference Update="Microsoft.AspNetCore.DataProtection.AzureKeyVault" Version="3.1.24" />
<PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.20" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<PackageReference Update="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Update="Microsoft.Azure.Security.KeyVault.Secrets" Version="4.5.0" />
<PackageReference Update="Microsoft.Azure.Services.AppAuthentication" Version="1.6.2" />
<PackageReference Update="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.24" />
<PackageReference Update="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
<PackageReference Update="HtmlAgilityPack" Version="1.11.61" />
<PackageReference Update="Microsoft.DiaSymReader.Native" Version="1.7.0" />
<PackageReference Update="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.16" />
<PackageReference Update="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.17" />
<PackageReference Update="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Tools" Version="8.0.7" />
<PackageReference Update="Microsoft.FeatureManagement.AspNetCore" Version="3.4.0" />
<PackageReference Update="Scrutor" Version="4.2.2" />
<PackageReference Update="Swashbuckle.AspNetCore" Version="6.6.2" />
Expand All @@ -41,12 +41,12 @@

<ItemGroup Label="Packages used for testing">
<PackageReference Update="FluentAssertions" Version="6.12.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.20" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.7" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<!-- Do not upgrade Moq version from 4.18.4 -->
<PackageReference Update="Moq" Version="4.18.4" />
<PackageReference Update="xunit" Version="2.8.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.8.1" />
<PackageReference Update="xunit" Version="2.9.0" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Update="coverlet.collector" Version="6.0.2" />
<PackageReference Update="Basic.Reference.Assemblies" Version="1.7.2" />
<PackageReference Update="Fare" Version="2.2.1" />
Expand All @@ -55,7 +55,7 @@
<PackageReference Update="Microsoft.CodeAnalysis.Common" Version="4.10.0" />
<PackageReference Update="Testcontainers" Version="3.9.0" />
<PackageReference Update="Testcontainers.PostgreSql" Version="3.9.0" />
<PackageReference Update="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Update="Microsoft.AspNetCore.SignalR.Client" Version="8.0.7" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="8.0.1" />
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions charts/eid-logger/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/eid-logger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: eid-logger
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
22 changes: 22 additions & 0 deletions charts/eid-logger/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "eid-logger.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "eid-logger.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "eid-logger.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "eid-logger.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/eid-logger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "eid-logger.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "eid-logger.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "eid-logger.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "eid-logger.labels" -}}
helm.sh/chart: {{ include "eid-logger.chart" . }}
{{ include "eid-logger.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "eid-logger.selectorLabels" -}}
app.kubernetes.io/name: {{ include "eid-logger.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "eid-logger.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "eid-logger.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading

0 comments on commit ea09e32

Please sign in to comment.