Skip to content

Commit

Permalink
fix: array in autogen cleanup, add test for polysite route (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Nov 2, 2023
1 parent 63fdf16 commit 401b88b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 10 deletions.
19 changes: 19 additions & 0 deletions cmd/template_autogen_ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,25 @@ func TestAutogeneratedIngressGeneration(t *testing.T) {
emptyDir: true,
want: "",
},
{
name: "test26 polysite autogenerated routes enabled globally but disabled by environment",
args: args{
alertContact: "alertcontact",
statusPageID: "statuspageid",
projectName: "example-project",
environmentName: "main",
environmentType: "production",
buildType: "branch",
lagoonVersion: "v2.7.x",
branch: "main",
projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${service}-${project}-${environment}.example.com","scope":"internal_system"}]`,
envVars: `[]`,
lagoonYAML: "../test-resources/template-autogenerated/test26/lagoon.yml",
templatePath: "../test-resources/template-autogenerated/output",
},
emptyDir: true,
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions legacy/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1106,11 +1106,11 @@ for AR in $AUTOGEN_ROUTES; do
fi
MATCHED_AUTOGEN=false
done
for DA in $DELETE_AUTOGEN; do
for DA in ${!DELETE_AUTOGEN[@]}; do
# delete any autogenerated ingress in the namespace as they are disabled
if kubectl -n ${NAMESPACE} get ingress ${DA} &> /dev/null; then
echo ">> Removing autogenerated ingress for ${DA} because it was disabled"
kubectl -n ${NAMESPACE} delete ingress ${DA}
if kubectl -n ${NAMESPACE} get ingress ${DELETE_AUTOGEN[$DA]} &> /dev/null; then
echo ">> Removing autogenerated ingress for ${DELETE_AUTOGEN[$DA]} because it was disabled"
kubectl -n ${NAMESPACE} delete ingress ${DELETE_AUTOGEN[$DA]}
fi
done

Expand Down
13 changes: 7 additions & 6 deletions test-resources/template-autogenerated/test25/lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ routes:
environment_variables:
git_sha: "true"

environments:
main:
autogenerateRoutes: false
routes:
- node:
- example.com
example-project:
environments:
main:
autogenerateRoutes: false
routes:
- node:
- example.com
20 changes: 20 additions & 0 deletions test-resources/template-autogenerated/test26/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '2'
services:
node:
networks:
- amazeeio-network
- default
build:
context: .
dockerfile: node.dockerfile
labels:
lagoon.type: node
volumes:
- .:/app:delegated
environment:
- LAGOON_LOCALDEV_HTTP_PORT=3000
- LAGOON_ROUTE=http://node.docker.amazee.io

networks:
amazeeio-network:
external: true
17 changes: 17 additions & 0 deletions test-resources/template-autogenerated/test26/lagoon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
docker-compose-yaml: ../test-resources/template-autogenerated/test6/docker-compose.yml

routes:
autogenerate:
enabled: true
insecure: Redirect
allowPullrequests: false

environment_variables:
git_sha: "true"

environments:
main:
autogenerateRoutes: false
routes:
- node:
- example.com

0 comments on commit 401b88b

Please sign in to comment.