Skip to content

Commit d19a6c2

Browse files
jhunzikJosh Hunziker
andauthored
Refactor to support modular routing (#40)
* Refactor app to support multiple endpoints. * Update Readme * Update git workflows * Bump versions * rename keip controller artifact to 'webapp' * Update operator image --------- Co-authored-by: Josh Hunziker <joshua.hunziker@octo.us>
1 parent c771eb6 commit d19a6c2

Some content is hidden

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

47 files changed

+774
-756
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This monorepo consists of 3 artifacts that are versioned, built, and released separately.
33
- minimal-app
44
- operator
5-
- operator/webhook
5+
- operator/webapp
66

77
## PR builds
88
When a PR is opened or updated, it will determine if any files changed in each of the sub-project directories.

.github/workflows/operator.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
- operator/**
77
- .github/workflows/operator.yml
88
- .github/workflows/scripts
9-
- "!operator/webhook/**"
9+
- "!operator/webapp/**"
1010
- '!**.md'
1111
- '!operator/examples/**'
1212
push:
1313
branches:
1414
- main
1515
paths:
1616
- operator/**
17-
- "!operator/webhook/**"
17+
- "!operator/webapp/**"
1818
- '!**.md'
1919
- '!operator/examples/**'
2020

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
OPERATOR_DIR=operator
2+
OPERATOR_CONTROLLER_YAML=$OPERATOR_DIR/controller/core-controller.yaml
3+
4+
verify_current_webapp_img() {
5+
current_webapp_img=$(make --no-print-directory -C operator/webapp get-image-name)
6+
webapp_image_used=$(yq eval '.spec.template.spec.containers[].image' $OPERATOR_CONTROLLER_YAML)
7+
8+
test -n "$current_webapp_img"
9+
test -n "$webapp_image_used"
10+
11+
error_message="Operator is using $webapp_image_used but should be using the most recent $current_webapp_img."
12+
test "$webapp_image_used" = "$current_webapp_img" || (echo $error_message && exit 1)
13+
}
14+
15+
verify_current_webapp_img

.github/workflows/scripts/shared/verify_current_webhook_img.sh

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

.github/workflows/scripts/verify_operator_releasable.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ verify_version_bump() {
77
sh .github/workflows/scripts/shared/verify_changes_update_version.sh $potential_tag $OPERATOR_DIR \
88
'-e ^operator/examples/
99
-e ^operator/example/
10-
-e ^operator/webhook/'
10+
-e ^operator/webapp/'
1111
}
1212

13-
sh .github/workflows/scripts/shared/verify_current_webhook_img.sh
13+
sh .github/workflows/scripts/shared/verify_current_webapp_img.sh
1414
verify_version_bump
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set -eux
2+
3+
WEBAPP_DIR=operator/webapp
4+
5+
verify_version_bump() {
6+
potential_tag=$(make --no-print-directory -C $WEBAPP_DIR get-tag)
7+
8+
# Changes to the Makefile are excluded since they will not change the webhook image
9+
sh .github/workflows/scripts/shared/verify_changes_update_version.sh $potential_tag $WEBAPP_DIR '-e Makefile$'
10+
}
11+
12+
sh .github/workflows/scripts/shared/verify_current_webapp_img.sh
13+
verify_version_bump

.github/workflows/scripts/verify_webhook_releasable.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
name: webhook
1+
name: webapp
22
on:
33
workflow_dispatch:
44
pull_request:
55
paths:
6-
- operator/webhook/**
7-
- .github/workflows/webhook.yml
6+
- operator/webapp/**
7+
- .github/workflows/webapp.yml
88
- .github/workflows/scripts
99
- '!**.md'
1010
push:
1111
branches:
1212
- main
1313
paths:
14-
- operator/webhook/**
14+
- operator/webapp/**
1515
- '!**.md'
1616

1717
env:
1818
PYTHON_VERSION: 3.11
19-
WORKING_DIR: ./operator/webhook
19+
WORKING_DIR: ./operator/webapp
2020

2121
jobs:
2222
verify-versions:
2323
if: github.ref != 'refs/heads/main'
2424
runs-on: ubuntu-latest
2525
steps:
2626
- uses: actions/checkout@v4
27-
- run: sh .github/workflows/scripts/verify_webhook_releasable.sh
28-
name: Verify webhook is in a state to be released on merge
27+
- run: sh .github/workflows/scripts/verify_webapp_releasable.sh
28+
name: Verify webapp is in a state to be released on merge
2929
test:
3030
name: unit test
3131
runs-on: ubuntu-latest

operator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION ?= 0.13.0
1+
VERSION ?= 0.13.1
22
GIT_TAG := operator_v$(VERSION)
33
KEIP_INTEGRATION_IMAGE ?= ghcr.io/codice/keip/minimal-app:latest
44

operator/controller/core-controller.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
hooks:
3232
sync:
3333
webhook:
34-
url: http://integrationroute-webhook.keip/sync
34+
url: http://integrationroute-webhook.keip/webhook/sync
3535
timeout: 10s
3636
---
3737
apiVersion: v1
@@ -56,7 +56,7 @@ spec:
5656
spec:
5757
containers:
5858
- name: webhook
59-
image: ghcr.io/codice/keip/route-webhook:0.15.0
59+
image: ghcr.io/codice/keip/webapp:0.16.0
6060
ports:
6161
- containerPort: 7080
6262
name: webhook-http

0 commit comments

Comments
 (0)