Skip to content

Commit d3023db

Browse files
danielskovlibjorntoremartinothamarvxkcclaude
authored
feat: Workflow engine (#17635)
Co-authored-by: Bjørn Tore Gjerde <btgjerde@gmail.com> Co-authored-by: Martin Othamar <martin.othamar@digdir.no> Co-authored-by: Tobias Netskar <51908451+vxkc@users.noreply.github.com> Co-authored-by: Tobias Netskar <git@t4s.no> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Bjørn Tore Gjerde <bjorn-tore.gjerde@digdir.no>
1 parent ca71a1b commit d3023db

File tree

426 files changed

+54610
-295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

426 files changed

+54610
-295
lines changed

.github/workflows/deploy-runtime-gateway.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8+
- src/common/**
89
- src/Runtime/gateway/**
910
- infra/runtime/syncroot/base/gateway.yaml
1011
- infra/runtime/flux-config/**
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Runtime - deploy workflow-engine-app
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- src/common/**
9+
- src/Runtime/workflow-engine/src/**
10+
- src/Runtime/workflow-engine/Directory.Packages.props
11+
- src/Runtime/workflow-engine-app/src/**
12+
- src/Runtime/workflow-engine-app/Directory.Packages.props
13+
- src/Runtime/workflow-engine-app/Dockerfile
14+
- src/Runtime/workflow-engine-app/Dockerfile.dockerignore
15+
- src/Runtime/workflow-engine-app/infra/**
16+
- infra/runtime/syncroot/base/workflow-engine-app.yaml
17+
- infra/runtime/flux-config/**
18+
- .github/workflows/deploy-runtime-workflow-engine-app.yaml
19+
workflow_dispatch:
20+
inputs:
21+
environments:
22+
description: "Runtime environments to tag. Comma-separated (e.g. at_ring1,at_ring2)."
23+
required: false
24+
default: "tt_ring1"
25+
tag-latest:
26+
description: 'Tag the GHCR image as "latest"'
27+
required: false
28+
default: false
29+
type: boolean
30+
31+
permissions:
32+
id-token: write
33+
contents: read
34+
packages: write
35+
36+
jobs:
37+
38+
get-short-sha:
39+
uses: ./.github/workflows/template-short-sha.yaml
40+
41+
construct-rings-array:
42+
uses: ./.github/workflows/template-runtime-construct-environments.yaml
43+
with:
44+
inputs: ${{ toJSON(github.event.inputs) }}
45+
override-default-runtime-environments: tt_ring1
46+
47+
push-workflow-engine-app-artifact:
48+
name: Push workflow-engine-app as OCI artifact
49+
needs: get-short-sha
50+
runs-on: ubuntu-latest
51+
environment: dev
52+
env:
53+
REGISTRY_NAME: altinncr
54+
IMAGE_REPO: altinncr.azurecr.io/studio-apps/runtime-workflow-engine-app:${{ needs.get-short-sha.outputs.short-sha }}
55+
CONFIG_REPO: altinncr.azurecr.io/studio-apps/runtime-workflow-engine-app-repo:${{ needs.get-short-sha.outputs.short-sha }}
56+
GHCR_IMAGE: ghcr.io/altinn/altinn-studio/runtime-workflow-engine-app:${{ needs.get-short-sha.outputs.short-sha }}
57+
outputs:
58+
config-repo: altinncr.azurecr.io/studio-apps/runtime-workflow-engine-app-repo:${{ needs.get-short-sha.outputs.short-sha }}
59+
defaults:
60+
run:
61+
working-directory: src/Runtime/workflow-engine-app
62+
steps:
63+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
64+
65+
- name: Set up Docker
66+
uses: docker/setup-docker-action@e43656e248c0bd0647d3f5c195d116aacf6fcaf4 # v4.7.0
67+
with:
68+
daemon-config: |
69+
{
70+
"features": {
71+
"containerd-snapshotter": true
72+
}
73+
}
74+
75+
- name: Set up QEMU
76+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
77+
78+
- name: az login
79+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
80+
with:
81+
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
82+
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
83+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
84+
85+
- name: az acr login
86+
run: az acr login --name ${{ env.REGISTRY_NAME }}
87+
88+
- name: flux install
89+
uses: fluxcd/flux2/action@bfa461ed2153ae5e0cca6bce08e0845268fb3088 # v2.8.2
90+
91+
- name: Login to GHCR
92+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
93+
94+
- name: docker build
95+
working-directory: src
96+
run: |
97+
TAGS="-t ${{ env.IMAGE_REPO }} -t ${{ env.GHCR_IMAGE }}"
98+
if [ "${{ inputs.tag-latest }}" = "true" ]; then
99+
TAGS="$TAGS -t ghcr.io/altinn/altinn-studio/runtime-workflow-engine-app:latest"
100+
fi
101+
docker build --platform linux/amd64,linux/arm64 $TAGS -f Runtime/workflow-engine-app/Dockerfile .
102+
103+
- name: push image
104+
run: docker push ${{ env.IMAGE_REPO }}
105+
106+
- name: push GHCR image
107+
run: |
108+
docker push ${{ env.GHCR_IMAGE }}
109+
if [ "${{ inputs.tag-latest }}" = "true" ]; then
110+
docker push ghcr.io/altinn/altinn-studio/runtime-workflow-engine-app:latest
111+
fi
112+
113+
- name: patch base with image tag
114+
working-directory: src/Runtime/workflow-engine-app/infra/kustomize/base
115+
run: |
116+
export IMAGE="${{ env.IMAGE_REPO }}"
117+
export IMAGE_TAG="${{ needs.get-short-sha.outputs.short-sha }}"
118+
yq -i '.metadata.annotations["altinn.studio/image"] = env(IMAGE)' deployment.yaml
119+
yq -i '.metadata.annotations["altinn.studio/image-tag"] = env(IMAGE_TAG)' deployment.yaml
120+
121+
- name: push artifact
122+
working-directory: src/Runtime/workflow-engine-app/infra/kustomize
123+
run: |
124+
flux push artifact oci://${{ env.CONFIG_REPO }} \
125+
--provider=azure \
126+
--reproducible \
127+
--path="." \
128+
--source="$(git config --get remote.origin.url)" \
129+
--revision="$(git branch --show-current)/$(git rev-parse HEAD)"
130+
131+
tag-workflow-engine-app:
132+
name: Tag workflow-engine-app
133+
needs: [push-workflow-engine-app-artifact, construct-rings-array]
134+
runs-on: ubuntu-latest
135+
environment: ${{ matrix.environment }}
136+
strategy:
137+
matrix:
138+
include: ${{ fromJson(needs.construct-rings-array.outputs.result) }}
139+
steps:
140+
- name: az login
141+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
142+
with:
143+
client-id: ${{ secrets.AZURE_CLIENT_ID_FC }}
144+
tenant-id: ${{ secrets.AZURE_TENANT_ID_FC }}
145+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID_FC }}
146+
147+
- name: az acr login
148+
run: az acr login --name altinncr
149+
150+
- name: flux install
151+
uses: fluxcd/flux2/action@bfa461ed2153ae5e0cca6bce08e0845268fb3088 # v2.8.2
152+
153+
- name: tag artifact
154+
run: |
155+
flux tag artifact oci://${{ needs.push-workflow-engine-app-artifact.outputs.config-repo }} \
156+
--tag ${{ matrix.ring }}

.github/workflows/deploy-runtime-workflow-engine.yaml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/runtime-gateway-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
types: [opened, reopened, synchronize, ready_for_review]
66
paths:
7+
- 'src/common/**'
78
- 'src/Runtime/gateway/**'
89
- 'src/Runtime/devenv/**'
910
- '.github/workflows/runtime-gateway-tests.yaml'
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Runtime Workflow Engine App - Build and test
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, ready_for_review]
6+
paths:
7+
- 'src/common/**'
8+
- 'src/Runtime/workflow-engine/src/**'
9+
- 'src/Runtime/workflow-engine/tests/**'
10+
- 'src/Runtime/workflow-engine/Directory.Build.props'
11+
- 'src/Runtime/workflow-engine/Directory.Packages.props'
12+
- 'src/Runtime/workflow-engine-app/src/**'
13+
- 'src/Runtime/workflow-engine-app/tests/**'
14+
- 'src/Runtime/workflow-engine-app/Directory.Build.props'
15+
- 'src/Runtime/workflow-engine-app/Directory.Packages.props'
16+
- '.github/workflows/runtime-workflow-engine-app-tests.yaml'
17+
workflow_dispatch:
18+
19+
jobs:
20+
build-and-test:
21+
name: Build and test
22+
runs-on: ubuntu-latest
23+
defaults:
24+
run:
25+
working-directory: src/Runtime/workflow-engine-app/
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5
34+
with:
35+
dotnet-version: |
36+
10.0.x
37+
38+
- name: Restore
39+
run: dotnet restore
40+
41+
- name: Build
42+
run: dotnet build --no-restore
43+
env:
44+
CI: true
45+
46+
- name: Test
47+
run: dotnet test --no-build
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Runtime Workflow Engine - Build and test
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, ready_for_review]
6+
paths:
7+
- 'src/common/**'
8+
- 'src/Runtime/workflow-engine/src/**'
9+
- 'src/Runtime/workflow-engine/tests/**'
10+
- 'src/Runtime/workflow-engine/Directory.Build.props'
11+
- 'src/Runtime/workflow-engine/Directory.Packages.props'
12+
- '.github/workflows/runtime-workflow-engine-tests.yaml'
13+
workflow_dispatch:
14+
15+
jobs:
16+
build-and-test:
17+
name: Build and test
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: src/Runtime/workflow-engine/
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5
30+
with:
31+
dotnet-version: |
32+
10.0.x
33+
34+
- name: Restore
35+
run: dotnet restore
36+
37+
- name: Build
38+
run: dotnet build --no-restore
39+
env:
40+
CI: true
41+
42+
- name: Test
43+
run: dotnet test --no-build

.husky/pre-commit

100644100755
File mode changed.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ DEVELOP_USER_SETTINGS=0
120120
```
121121

122122
## Developing Backend
123-
124123
Navigate to the designer backend folder `cd src/Designer/backend/src/Designer`. The first time running, or after any package changes,
125124
get the latest packages.
126125

infra/runtime/syncroot/base/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ resources:
1111
- altinn-charts.yaml
1212
- apps-syncroot.yaml
1313
- observability.yaml
14+
- workflow-engine-app.yaml
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: runtime-workflow-engine-app
5+
labels:
6+
altinn.studio/runtime: "true"
7+
---
8+
apiVersion: v1
9+
kind: ConfigMap
10+
metadata:
11+
name: runtime-environment
12+
namespace: runtime-workflow-engine-app
13+
data:
14+
upgrade_channel: ${UPGRADE_CHANNEL}
15+
environment: ${ENVIRONMENT}
16+
serviceowner: ${SERVICEOWNER_ID}
17+
---
18+
apiVersion: source.toolkit.fluxcd.io/v1
19+
kind: OCIRepository
20+
metadata:
21+
name: workflow-engine-app-repo
22+
namespace: runtime-workflow-engine-app
23+
spec:
24+
interval: 5m
25+
provider: azure
26+
ref:
27+
tag: ${UPGRADE_CHANNEL}
28+
timeout: 5m
29+
url: oci://altinncr.azurecr.io/studio-apps/runtime-workflow-engine-app-repo
30+
---
31+
apiVersion: kustomize.toolkit.fluxcd.io/v1
32+
kind: Kustomization
33+
metadata:
34+
name: workflow-engine-app
35+
namespace: runtime-workflow-engine-app
36+
spec:
37+
targetNamespace: runtime-workflow-engine-app
38+
interval: 5m
39+
retryInterval: 5m
40+
timeout: 1m
41+
prune: true
42+
force: false
43+
wait: true
44+
path: ./${ENVIRONMENT}
45+
sourceRef:
46+
kind: OCIRepository
47+
name: workflow-engine-app-repo
48+
namespace: runtime-workflow-engine-app

0 commit comments

Comments
 (0)