zuplo 7.15.32 → 7.15.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/ai-gateway/azure-ai.mdx +2 -6
- package/docs/ai-gateway/bedrock-mantle.mdx +2 -6
- package/docs/ai-gateway/cookbooks/data-residency.mdx +3 -7
- package/docs/ai-gateway/custom-pricing.mdx +54 -0
- package/docs/ai-gateway/guardrails.mdx +1 -3
- package/docs/ai-gateway/jev.mdx +35 -0
- package/docs/ai-gateway/managing-apps.mdx +17 -0
- package/docs/ai-gateway/managing-providers.mdx +11 -0
- package/docs/ai-gateway/observability/analytics.mdx +2 -2
- package/docs/ai-gateway/openrouter.mdx +20 -0
- package/docs/ai-gateway/routing.mdx +50 -15
- package/docs/ai-gateway/universal-api.mdx +50 -6
- package/docs/ai-gateway/user-apps.mdx +44 -2
- package/docs/ai-gateway/vertex-ai.mdx +5 -13
- package/docs/analytics/shared-controls.md +5 -0
- package/docs/analytics/tabs/consumers.md +36 -0
- package/docs/articles/api-key-api.mdx +16 -1
- package/docs/articles/api-key-buckets.mdx +1 -1
- package/docs/articles/api-key-consumer-bucket-portal-ui.mdx +1 -1
- package/docs/articles/api-key-self-serve-integration.mdx +1 -1
- package/docs/articles/api-lint-configuration.mdx +21 -0
- package/docs/articles/api-lint-custom-rules.mdx +6 -0
- package/docs/articles/branch-based-deployments.mdx +11 -3
- package/docs/articles/ci-cd-azure/multi-stage-deployment.mdx +2 -2
- package/docs/articles/ci-cd-azure/pr-preview-environments.mdx +23 -4
- package/docs/articles/ci-cd-azure/tag-based-releases.mdx +1 -1
- package/docs/articles/ci-cd-bitbucket/multi-stage-deployment.mdx +3 -4
- package/docs/articles/ci-cd-bitbucket/pr-preview-environments.mdx +6 -5
- package/docs/articles/ci-cd-bitbucket/tag-based-releases.mdx +1 -1
- package/docs/articles/ci-cd-circleci/multi-stage-deployment.mdx +2 -3
- package/docs/articles/ci-cd-circleci/pr-preview-environments.mdx +6 -5
- package/docs/articles/ci-cd-circleci/tag-based-releases.mdx +1 -3
- package/docs/articles/ci-cd-github/basic-deployment.mdx +6 -6
- package/docs/articles/ci-cd-github/cleanup-on-branch-delete.mdx +8 -20
- package/docs/articles/ci-cd-github/deploy-and-test.mdx +3 -3
- package/docs/articles/ci-cd-github/local-testing.mdx +1 -1
- package/docs/articles/ci-cd-github/multi-stage-deployment.mdx +2 -3
- package/docs/articles/ci-cd-github/pr-preview-environments.mdx +20 -31
- package/docs/articles/ci-cd-github/tag-based-releases.mdx +5 -3
- package/docs/articles/ci-cd-gitlab/mr-preview-environments.mdx +10 -4
- package/docs/articles/ci-cd-gitlab/multi-stage-deployment.mdx +3 -3
- package/docs/articles/ci-cd-gitlab/tag-based-releases.mdx +1 -1
- package/docs/articles/connect-to-aws-alb-with-mtls.mdx +2 -6
- package/docs/articles/custom-ci-cd-azure.mdx +2 -2
- package/docs/articles/custom-ci-cd-bitbucket.mdx +2 -2
- package/docs/articles/custom-ci-cd-circleci.mdx +2 -2
- package/docs/articles/custom-ci-cd-github.mdx +10 -11
- package/docs/articles/custom-ci-cd-gitlab.mdx +2 -2
- package/docs/articles/environment-variables.mdx +55 -0
- package/docs/articles/monetization/api-access.mdx +126 -9
- package/docs/articles/monetization/meters.mdx +49 -2
- package/docs/articles/monetization/subscription-lifecycle.md +117 -19
- package/docs/articles/monetization/usage.mdx +58 -0
- package/docs/articles/monorepo-deployment.mdx +10 -25
- package/docs/articles/openapi.mdx +14 -0
- package/docs/articles/proxy-openai-realtime-api.mdx +6 -2
- package/docs/articles/secure-tunnel.mdx +3 -7
- package/docs/articles/support.mdx +35 -0
- package/docs/articles/testing-preview-environments.mdx +1 -1
- package/docs/caching/custom-caching-policy.mdx +4 -4
- package/docs/caching/dynamic-cache-rules.mdx +3 -3
- package/docs/caching/overview.mdx +2 -6
- package/docs/cli/delete.mdx +50 -0
- package/docs/cli/delete.partial.mdx +52 -0
- package/docs/cli/deploy.mdx +35 -18
- package/docs/cli/deploy.partial.mdx +35 -18
- package/docs/cli/variable-delete.mdx +36 -0
- package/docs/cli/variable-delete.partial.mdx +37 -0
- package/docs/concepts/source-control-and-deployment.mdx +9 -17
- package/docs/concepts/where-zuplo-runs.mdx +4 -12
- package/docs/dedicated/akamai/ai-powered-applications.mdx +5 -15
- package/docs/dedicated/akamai/architecture.mdx +11 -33
- package/docs/dedicated/akamai/hostname-routing.mdx +4 -4
- package/docs/dedicated/architecture.mdx +1 -1
- package/docs/dedicated/source-control.mdx +1 -1
- package/docs/dev-portal/dev-portal-create-consumer-on-auth.mdx +1 -1
- package/docs/dev-portal/overview.mdx +23 -0
- package/docs/dev-portal/zudoku/components/alert.mdx +1 -1
- package/docs/dev-portal/zudoku/configuration/api-reference.md +52 -0
- package/docs/dev-portal/zudoku/configuration/authentication-auth0.md +25 -0
- package/docs/dev-portal/zudoku/configuration/authentication-azure-ad.md +7 -0
- package/docs/dev-portal/zudoku/configuration/authentication-openid.md +48 -2
- package/docs/dev-portal/zudoku/configuration/authentication.md +4 -0
- package/docs/dev-portal/zudoku/configuration/build-configuration.mdx +4 -0
- package/docs/dev-portal/zudoku/configuration/navigation.mdx +15 -1
- package/docs/dev-portal/zudoku/configuration/overview.md +3 -0
- package/docs/dev-portal/zudoku/custom-plugins.md +38 -1
- package/docs/dev-portal/zudoku/guides/server-side-content-protection.md +7 -7
- package/docs/dev-portal/zudoku/openapi-extensions/x-enum-descriptions.md +85 -0
- package/docs/dev-portal/zudoku-partials/configuration/authentication-auth0.partial.md +24 -0
- package/docs/errors/build-error.mdx +58 -0
- package/docs/guides/backend-failover.mdx +9 -8
- package/docs/mcp-gateway/auth/configuring-entra.mdx +59 -0
- package/docs/mcp-gateway/auth/configuring-okta.mdx +30 -6
- package/docs/mcp-gateway/auth/configuring-workos.mdx +26 -0
- package/docs/mcp-gateway/auth/overview.mdx +2 -2
- package/docs/mcp-gateway/auth/upstream-oauth.mdx +1 -1
- package/docs/mcp-gateway/overview.mdx +1 -1
- package/docs/mcp-server/authorize-tool-calls.mdx +6 -2
- package/docs/policies/mcp-entra-oauth-inbound/doc.md +24 -0
- package/docs/policies/mcp-entra-oauth-inbound/schema.json +13 -0
- package/docs/policies/mcp-okta-oauth-inbound/doc.md +9 -2
- package/docs/policies/mcp-okta-oauth-inbound/schema.json +2 -2
- package/docs/policies/mcp-workos-oauth-inbound/doc.md +8 -0
- package/docs/policies/mcp-workos-oauth-inbound/schema.json +7 -0
- package/docs/policies/request-validation-inbound/doc.md +54 -0
- package/docs/programmable-api/environment.mdx +10 -2
- package/package.json +5 -5
|
@@ -391,6 +391,27 @@ A route meets a requirement when its `x-zuplo-route.policies.inbound` (or
|
|
|
391
391
|
different policies, scope each requirement to its routes with a
|
|
392
392
|
[custom rule](./api-lint-custom-rules.mdx#require-a-policy-on-some-routes).
|
|
393
393
|
|
|
394
|
+
#### Migrate from `policyTypes`
|
|
395
|
+
|
|
396
|
+
Earlier versions of the linter identified a required policy with `policyTypes`,
|
|
397
|
+
a list of policy type prefixes. For example, `"policyTypes": ["api-key"]`
|
|
398
|
+
matched a policy of type `api-key-inbound`. `policyTypes` is deprecated and will
|
|
399
|
+
be removed in an upcoming release, after which a configuration that still uses
|
|
400
|
+
it fails to load. Until then it keeps working, and each run prints a
|
|
401
|
+
`DEPRECATED` warning.
|
|
402
|
+
|
|
403
|
+
To migrate, replace `policyTypes` with `policyName`, the exact `name` of the
|
|
404
|
+
policy in `config/policies.json`, and keep `direction` as it is. A requirement
|
|
405
|
+
can't set both `policyName` and `policyTypes`.
|
|
406
|
+
|
|
407
|
+
```jsonc
|
|
408
|
+
// Before
|
|
409
|
+
{ "id": "require-auth", "policyTypes": ["api-key"], "direction": "inbound" }
|
|
410
|
+
|
|
411
|
+
// After
|
|
412
|
+
{ "id": "require-auth", "policyName": "api-key-auth", "direction": "inbound" }
|
|
413
|
+
```
|
|
414
|
+
|
|
394
415
|
Requirements with `"severity": "error"` report under the rule ID
|
|
395
416
|
`zuplo/require-policy`. Requirements with `"severity": "warn"` report under
|
|
396
417
|
`zuplo/require-policy-warn`.
|
|
@@ -147,6 +147,12 @@ choose:
|
|
|
147
147
|
contain that exact policy name from `config/policies.json`. Add one rule per
|
|
148
148
|
requirement, each with its own ID and `paths`.
|
|
149
149
|
|
|
150
|
+
`zuplo:requirePolicy` used to take `policyTypes`, a list of policy type
|
|
151
|
+
prefixes. `policyTypes` is deprecated and will be removed in an upcoming
|
|
152
|
+
release. Replace it with `policyName`, the exact name of the policy in
|
|
153
|
+
`config/policies.json`. See
|
|
154
|
+
[Migrate from `policyTypes`](./api-lint-configuration.mdx#migrate-from-policytypes).
|
|
155
|
+
|
|
150
156
|
### Enforce a naming convention
|
|
151
157
|
|
|
152
158
|
```jsonc
|
|
@@ -128,8 +128,12 @@ of your project.
|
|
|
128
128
|
|
|
129
129
|
## Deleting Environments
|
|
130
130
|
|
|
131
|
-
When
|
|
132
|
-
|
|
131
|
+
When your project uses the GitHub integration, deleting a branch deletes the
|
|
132
|
+
corresponding Preview environment, including its
|
|
133
|
+
[Developer Portal](../dev-portal/overview.mdx), so the portal's hostnames stop
|
|
134
|
+
serving. Zuplo never deletes the Production environment or a protected
|
|
135
|
+
environment this way. With other source control providers, deleting a branch
|
|
136
|
+
doesn't delete the environment. To delete an environment yourself:
|
|
133
137
|
|
|
134
138
|
1. In your project, open the
|
|
135
139
|
[**Environments**](https://portal.zuplo.com/+/account/project/environments)
|
|
@@ -139,9 +143,13 @@ environment is **not automatically deleted**. To delete an environment:
|
|
|
139
143
|
Alternatively, use the [Zuplo CLI](../cli/delete.mdx):
|
|
140
144
|
|
|
141
145
|
```bash
|
|
142
|
-
npx zuplo delete --
|
|
146
|
+
npx zuplo delete --branch my-new-feature --api-key $ZUPLO_API_KEY
|
|
143
147
|
```
|
|
144
148
|
|
|
149
|
+
You can also delete an environment by its URL with
|
|
150
|
+
`zuplo delete --url https://your-environment-url.zuplo.app`. Pass either
|
|
151
|
+
`--branch` or `--url`, not both.
|
|
152
|
+
|
|
145
153
|
## Automatic Deployments on Push
|
|
146
154
|
|
|
147
155
|
With the Git integration enabled, every push to a branch triggers an automatic
|
|
@@ -34,7 +34,7 @@ stages:
|
|
|
34
34
|
|
|
35
35
|
- script: |
|
|
36
36
|
set -o pipefail
|
|
37
|
-
npx zuplo deploy --api-key $(ZUPLO_API_KEY) --
|
|
37
|
+
npx zuplo deploy --api-key $(ZUPLO_API_KEY) --branch staging 2>&1 | tee ./STAGING_STDOUT
|
|
38
38
|
STAGING_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)' ./STAGING_STDOUT)
|
|
39
39
|
echo "##vso[task.setvariable variable=STAGING_URL;isOutput=true]$STAGING_URL"
|
|
40
40
|
name: deployStep
|
|
@@ -79,7 +79,7 @@ stages:
|
|
|
79
79
|
- script: npm install
|
|
80
80
|
|
|
81
81
|
- script:
|
|
82
|
-
npx zuplo deploy --api-key $(ZUPLO_API_KEY) --
|
|
82
|
+
npx zuplo deploy --api-key $(ZUPLO_API_KEY) --branch
|
|
83
83
|
production
|
|
84
84
|
displayName: "Deploy to production"
|
|
85
85
|
```
|
|
@@ -34,23 +34,42 @@ steps:
|
|
|
34
34
|
|
|
35
35
|
- script: |
|
|
36
36
|
set -o pipefail
|
|
37
|
-
|
|
37
|
+
# System.PullRequest.SourceBranch is a full ref (refs/heads/my-feature)
|
|
38
|
+
# and is only set on pull request builds. Fall back to the build's branch.
|
|
39
|
+
case "$PR_SOURCE_BRANCH" in
|
|
40
|
+
refs/heads/*) BRANCH="${PR_SOURCE_BRANCH#refs/heads/}" ;;
|
|
41
|
+
*) BRANCH="${BUILD_SOURCE_BRANCH#refs/heads/}" ;;
|
|
42
|
+
esac
|
|
43
|
+
echo "##vso[task.setvariable variable=PREVIEW_BRANCH]$BRANCH"
|
|
44
|
+
npx zuplo deploy --branch "$BRANCH" --api-key $(ZUPLO_API_KEY) 2>&1 | tee ./DEPLOYMENT_STDOUT
|
|
38
45
|
displayName: "Deploy to Zuplo"
|
|
46
|
+
env:
|
|
47
|
+
PR_SOURCE_BRANCH: $(System.PullRequest.SourceBranch)
|
|
48
|
+
BUILD_SOURCE_BRANCH: $(Build.SourceBranch)
|
|
39
49
|
|
|
40
50
|
- script: |
|
|
41
51
|
DEPLOYMENT_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)' ./DEPLOYMENT_STDOUT)
|
|
42
|
-
echo "##vso[task.setvariable variable=DEPLOYMENT_URL]$DEPLOYMENT_URL"
|
|
43
52
|
npx zuplo test --endpoint "$DEPLOYMENT_URL"
|
|
44
53
|
displayName: "Run tests"
|
|
45
54
|
|
|
46
55
|
- script: |
|
|
47
|
-
npx zuplo delete --
|
|
56
|
+
npx zuplo delete --branch "$PREVIEW_BRANCH" --api-key $(ZUPLO_API_KEY) --wait
|
|
48
57
|
displayName: "Delete environment"
|
|
58
|
+
env:
|
|
59
|
+
PREVIEW_BRANCH: $(PREVIEW_BRANCH)
|
|
49
60
|
condition: eq(variables['Build.Reason'], 'PullRequest')
|
|
50
61
|
```
|
|
51
62
|
|
|
63
|
+
The deploy step passes `--branch` with the pull request's source branch. Without
|
|
64
|
+
it, a pull request build can create an environment named after the merge ref
|
|
65
|
+
instead of your branch. Azure Pipelines sets `System.PullRequest.SourceBranch`
|
|
66
|
+
to a full ref such as `refs/heads/my-feature`, so the script strips the
|
|
67
|
+
`refs/heads/` prefix. The variable is set only when a branch policy triggers the
|
|
68
|
+
build, so the script falls back to `Build.SourceBranch` for other runs. The
|
|
69
|
+
values reach the script through `env` instead of being written into it.
|
|
70
|
+
|
|
52
71
|
The cleanup step only runs for pull requests, deleting the preview environment
|
|
53
|
-
after tests pass.
|
|
72
|
+
by the same branch name after tests pass.
|
|
54
73
|
|
|
55
74
|
## Next Steps
|
|
56
75
|
|
|
@@ -33,7 +33,7 @@ steps:
|
|
|
33
33
|
|
|
34
34
|
- script: |
|
|
35
35
|
TAG_NAME=$(echo $(Build.SourceBranch) | sed 's|refs/tags/||')
|
|
36
|
-
npx zuplo deploy --api-key $(ZUPLO_API_KEY) --
|
|
36
|
+
npx zuplo deploy --api-key $(ZUPLO_API_KEY) --branch "$TAG_NAME"
|
|
37
37
|
displayName: "Deploy with tag name"
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -23,8 +23,8 @@ pipelines:
|
|
|
23
23
|
name: Deploy to Staging
|
|
24
24
|
script:
|
|
25
25
|
- npm install
|
|
26
|
-
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
27
|
-
|
|
26
|
+
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch staging 2>&1
|
|
27
|
+
| tee ./DEPLOYMENT_STDOUT
|
|
28
28
|
- echo "STAGING_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)'
|
|
29
29
|
./DEPLOYMENT_STDOUT)" >> staging.env
|
|
30
30
|
artifacts:
|
|
@@ -43,8 +43,7 @@ pipelines:
|
|
|
43
43
|
deployment: production
|
|
44
44
|
script:
|
|
45
45
|
- npm install
|
|
46
|
-
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
47
|
-
production
|
|
46
|
+
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch production
|
|
48
47
|
```
|
|
49
48
|
|
|
50
49
|
## Setting Up Approval
|
|
@@ -23,8 +23,8 @@ pipelines:
|
|
|
23
23
|
name: Deploy Preview
|
|
24
24
|
script:
|
|
25
25
|
- npm install
|
|
26
|
-
- npx zuplo deploy --
|
|
27
|
-
./DEPLOYMENT_STDOUT
|
|
26
|
+
- npx zuplo deploy --branch "$BITBUCKET_BRANCH" --api-key
|
|
27
|
+
"$ZUPLO_API_KEY" 2>&1 | tee ./DEPLOYMENT_STDOUT
|
|
28
28
|
- echo "DEPLOYMENT_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)'
|
|
29
29
|
./DEPLOYMENT_STDOUT)" >> deployment.env
|
|
30
30
|
artifacts:
|
|
@@ -40,13 +40,14 @@ pipelines:
|
|
|
40
40
|
- step:
|
|
41
41
|
name: Cleanup Preview
|
|
42
42
|
script:
|
|
43
|
-
- source deployment.env
|
|
44
43
|
- npm install
|
|
45
|
-
- npx zuplo delete --
|
|
44
|
+
- npx zuplo delete --branch "$BITBUCKET_BRANCH" --api-key
|
|
46
45
|
"$ZUPLO_API_KEY" --wait
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
The
|
|
48
|
+
The deploy step passes `--branch` with `BITBUCKET_BRANCH`, so the environment is
|
|
49
|
+
named after the pull request's source branch. The cleanup step deletes the
|
|
50
|
+
environment by the same branch name after tests complete.
|
|
50
51
|
|
|
51
52
|
## Next Steps
|
|
52
53
|
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
name: Deploy to Staging
|
|
28
28
|
command: |
|
|
29
29
|
set -o pipefail
|
|
30
|
-
npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
30
|
+
npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch staging 2>&1 | tee ./DEPLOYMENT_STDOUT
|
|
31
31
|
STAGING_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)' ./DEPLOYMENT_STDOUT)
|
|
32
32
|
echo "export STAGING_URL=$STAGING_URL" >> "$BASH_ENV"
|
|
33
33
|
echo "$STAGING_URL" > staging_url.txt
|
|
@@ -56,8 +56,7 @@ jobs:
|
|
|
56
56
|
steps:
|
|
57
57
|
- checkout
|
|
58
58
|
- run: npm install
|
|
59
|
-
- run:
|
|
60
|
-
npx zuplo deploy --api-key "$ZUPLO_API_KEY" --environment production
|
|
59
|
+
- run: npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch production
|
|
61
60
|
|
|
62
61
|
workflows:
|
|
63
62
|
staging-to-production:
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
name: Deploy to Zuplo
|
|
28
28
|
command: |
|
|
29
29
|
set -o pipefail
|
|
30
|
-
npx zuplo deploy --api-key "$ZUPLO_API_KEY" 2>&1 | tee ./DEPLOYMENT_STDOUT
|
|
30
|
+
npx zuplo deploy --branch "$CIRCLE_BRANCH" --api-key "$ZUPLO_API_KEY" 2>&1 | tee ./DEPLOYMENT_STDOUT
|
|
31
31
|
DEPLOYMENT_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)' ./DEPLOYMENT_STDOUT)
|
|
32
32
|
echo "export DEPLOYMENT_URL=$DEPLOYMENT_URL" >> "$BASH_ENV"
|
|
33
33
|
- run:
|
|
@@ -36,8 +36,8 @@ jobs:
|
|
|
36
36
|
- run:
|
|
37
37
|
name: Cleanup Preview
|
|
38
38
|
command:
|
|
39
|
-
npx zuplo delete --
|
|
40
|
-
--wait
|
|
39
|
+
npx zuplo delete --branch "$CIRCLE_BRANCH" --api-key
|
|
40
|
+
"$ZUPLO_API_KEY" --wait
|
|
41
41
|
when: always
|
|
42
42
|
|
|
43
43
|
workflows:
|
|
@@ -46,8 +46,9 @@ workflows:
|
|
|
46
46
|
- deploy-and-test
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
The
|
|
50
|
-
the
|
|
49
|
+
The deploy step passes `--branch` with `CIRCLE_BRANCH`, so the environment is
|
|
50
|
+
named after the branch being built. The cleanup step runs after tests complete
|
|
51
|
+
(whether they pass or fail), deleting the environment by the same branch name.
|
|
51
52
|
|
|
52
53
|
## Next Steps
|
|
53
54
|
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
|
|
37
37
|
- name: Deploy to Zuplo
|
|
38
38
|
run:
|
|
39
|
-
npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
39
|
+
npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch "${{
|
|
40
40
|
github.ref_name }}"
|
|
41
41
|
env:
|
|
42
42
|
ZUPLO_API_KEY: ${{ secrets.ZUPLO_API_KEY }}
|
|
@@ -51,11 +51,11 @@ This workflow:
|
|
|
51
51
|
|
|
52
52
|
Since this deploys from `main`, it updates your production environment.
|
|
53
53
|
|
|
54
|
-
Passing `--
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
Passing `--branch` is technically optional here — without it, the CLI infers the
|
|
55
|
+
environment name from the checked-out git ref — but inference can pick the wrong
|
|
56
|
+
name in CI (detached HEAD checkouts, commits that exist on more than one branch,
|
|
57
|
+
or `pull_request` merge refs). Passing the branch name explicitly makes every
|
|
58
|
+
workflow deploy a predictable environment. See the
|
|
59
59
|
[deploy command reference](../../cli/deploy.mdx) for details.
|
|
60
60
|
|
|
61
61
|
## Next Steps
|
|
@@ -39,32 +39,20 @@ jobs:
|
|
|
39
39
|
run: npm install
|
|
40
40
|
|
|
41
41
|
- name: Delete environment
|
|
42
|
-
|
|
42
|
+
env:
|
|
43
43
|
# The deleted branch name
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ENV_NAME=$(echo "$BRANCH_NAME" | tr '/_' '--' |
|
|
49
|
-
tr '[:upper:]' '[:lower:]' | cut -c1-10 | sed 's/-*$//')
|
|
50
|
-
|
|
51
|
-
# Find the deployment for the deleted branch and delete it by URL
|
|
52
|
-
npx zuplo list --api-key "$ZUPLO_API_KEY" \
|
|
53
|
-
--output json --show-details |
|
|
54
|
-
jq -r --arg env "$ENV_NAME" \
|
|
55
|
-
'.[] | select(.name | test("-" + $env + "-[a-z0-9]+$")) | .url' |
|
|
56
|
-
while read -r URL; do
|
|
57
|
-
echo "Deleting environment: $URL"
|
|
58
|
-
npx zuplo delete --url "$URL" --api-key "$ZUPLO_API_KEY" --wait || true
|
|
59
|
-
done
|
|
44
|
+
ENVIRONMENT: ${{ github.event.ref }}
|
|
45
|
+
run: |
|
|
46
|
+
npx zuplo delete --branch "$ENVIRONMENT" \
|
|
47
|
+
--api-key "$ZUPLO_API_KEY"
|
|
60
48
|
```
|
|
61
49
|
|
|
62
50
|
This workflow:
|
|
63
51
|
|
|
64
52
|
1. Triggers when any branch is deleted
|
|
65
|
-
2.
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
2. Passes the deleted branch name to `zuplo delete --branch`, which finds the
|
|
54
|
+
environment that branch deployed and deletes it
|
|
55
|
+
3. Continues without error if no matching environment exists
|
|
68
56
|
|
|
69
57
|
## Combining with PR Cleanup
|
|
70
58
|
|
|
@@ -53,7 +53,7 @@ jobs:
|
|
|
53
53
|
ENVIRONMENT: ${{ github.head_ref || github.ref_name }}
|
|
54
54
|
run: |
|
|
55
55
|
# Capture deployment output
|
|
56
|
-
OUTPUT=$(npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
56
|
+
OUTPUT=$(npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch "$ENVIRONMENT" 2>&1)
|
|
57
57
|
echo "$OUTPUT"
|
|
58
58
|
|
|
59
59
|
# Extract the deployment URL
|
|
@@ -70,8 +70,8 @@ This workflow:
|
|
|
70
70
|
2. Runs your test suite against the live deployment.
|
|
71
71
|
3. Fails the workflow if any tests fail.
|
|
72
72
|
|
|
73
|
-
The deploy step passes `--
|
|
74
|
-
|
|
73
|
+
The deploy step passes `--branch` explicitly because this workflow runs on both
|
|
74
|
+
`push` and `pull_request` events. The expression
|
|
75
75
|
`${{ github.head_ref || github.ref_name }}` resolves to the branch name on
|
|
76
76
|
either trigger, so every run for a branch updates the same environment. Without
|
|
77
77
|
it, `pull_request` runs create a second environment named after the PR merge ref
|
|
@@ -44,7 +44,7 @@ jobs:
|
|
|
44
44
|
id: deploy
|
|
45
45
|
shell: bash
|
|
46
46
|
run: |
|
|
47
|
-
OUTPUT=$(npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
47
|
+
OUTPUT=$(npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch staging 2>&1)
|
|
48
48
|
echo "$OUTPUT"
|
|
49
49
|
DEPLOYMENT_URL=$(echo "$OUTPUT" | grep -oP 'Deployed to \K(https://[^ ]+)')
|
|
50
50
|
echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
|
|
@@ -87,8 +87,7 @@ jobs:
|
|
|
87
87
|
run: npm install
|
|
88
88
|
|
|
89
89
|
- name: Deploy to production
|
|
90
|
-
run:
|
|
91
|
-
npx zuplo deploy --api-key "$ZUPLO_API_KEY" --environment production
|
|
90
|
+
run: npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch production
|
|
92
91
|
```
|
|
93
92
|
|
|
94
93
|
This workflow:
|
|
@@ -14,16 +14,16 @@ applies_to:
|
|
|
14
14
|
Give every pull request its own Zuplo environment. Reviewers can test changes
|
|
15
15
|
against a live API, and environments clean up automatically when PRs close.
|
|
16
16
|
|
|
17
|
-
:::caution{title="Pass --
|
|
17
|
+
:::caution{title="Pass --branch on pull_request events"}
|
|
18
18
|
|
|
19
19
|
Workflows triggered by `pull_request` check out the pull request **merge ref**
|
|
20
|
-
(`refs/pull/<number>/merge`), not your branch. Without `--
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
(`refs/pull/<number>/merge`), not your branch. Without `--branch`, the Zuplo CLI
|
|
21
|
+
derives the environment name from that ref and creates an environment named
|
|
22
|
+
`pull/<number>/merge` instead of one named after your branch. If anything else
|
|
23
|
+
deploys the same branch — a `push`-triggered workflow, the GitHub integration,
|
|
24
|
+
or a local `zuplo deploy` — you end up with two environments and two different
|
|
25
|
+
URLs for the same branch. Always pass `--branch` with the source branch name
|
|
26
|
+
(`github.head_ref`).
|
|
27
27
|
|
|
28
28
|
:::
|
|
29
29
|
|
|
@@ -66,7 +66,7 @@ jobs:
|
|
|
66
66
|
# pull_request events check out
|
|
67
67
|
ENVIRONMENT: ${{ github.head_ref }}
|
|
68
68
|
run: |
|
|
69
|
-
OUTPUT=$(npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
69
|
+
OUTPUT=$(npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch "$ENVIRONMENT" 2>&1)
|
|
70
70
|
echo "$OUTPUT"
|
|
71
71
|
DEPLOYMENT_URL=$(echo "$OUTPUT" | grep -oP 'Deployed to \K(https://[^ ]+)')
|
|
72
72
|
echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
|
|
@@ -102,44 +102,33 @@ jobs:
|
|
|
102
102
|
- name: Install dependencies
|
|
103
103
|
run: npm install
|
|
104
104
|
|
|
105
|
-
- name: Get deployment URL
|
|
106
|
-
id: get-url
|
|
107
|
-
uses: actions/github-script@v7
|
|
108
|
-
with:
|
|
109
|
-
script: |
|
|
110
|
-
const comments = await github.rest.issues.listComments({
|
|
111
|
-
issue_number: context.issue.number,
|
|
112
|
-
owner: context.repo.owner,
|
|
113
|
-
repo: context.repo.repo,
|
|
114
|
-
});
|
|
115
|
-
const match = comments.data
|
|
116
|
-
.map((c) => c.body.match(/Deployed to: (https:\/\/\S+)/))
|
|
117
|
-
.find(Boolean);
|
|
118
|
-
core.setOutput("url", match ? match[1] : "");
|
|
119
|
-
|
|
120
105
|
- name: Delete environment
|
|
121
|
-
|
|
106
|
+
env:
|
|
107
|
+
ENVIRONMENT: ${{ github.head_ref }}
|
|
122
108
|
run: |
|
|
123
109
|
npx zuplo delete \
|
|
124
|
-
--
|
|
125
|
-
--api-key "$ZUPLO_API_KEY"
|
|
126
|
-
--wait
|
|
110
|
+
--branch "$ENVIRONMENT" \
|
|
111
|
+
--api-key "$ZUPLO_API_KEY"
|
|
127
112
|
```
|
|
128
113
|
|
|
129
114
|
This workflow:
|
|
130
115
|
|
|
131
116
|
1. **On PR open/update**: Deploys to an environment named after the branch, runs
|
|
132
117
|
tests, and comments the URL on the PR
|
|
133
|
-
2. **On PR close**: Deletes the preview environment
|
|
118
|
+
2. **On PR close**: Deletes the preview environment by branch name, so the
|
|
119
|
+
cleanup job doesn't need the environment URL
|
|
134
120
|
|
|
135
121
|
## How It Works
|
|
136
122
|
|
|
137
|
-
- The deploy step passes `--
|
|
123
|
+
- The deploy step passes `--branch` with the PR's source branch name
|
|
138
124
|
(`github.head_ref`), so the environment is named after the branch — the same
|
|
139
125
|
name the [GitHub integration](../source-control-setup-github.mdx) would use
|
|
140
126
|
- Each push to the PR updates the same environment, so the environment URL stays
|
|
141
127
|
stable for the life of the branch
|
|
142
|
-
- Closing the PR (merge or abandon) triggers cleanup
|
|
128
|
+
- Closing the PR (merge or abandon) triggers cleanup. `zuplo delete --branch`
|
|
129
|
+
takes the same branch name the deploy step used and removes that branch's
|
|
130
|
+
environment. If the environment is already gone, the command exits without an
|
|
131
|
+
error
|
|
143
132
|
- The PR comment lets reviewers quickly access the preview
|
|
144
133
|
|
|
145
134
|
A stable environment URL matters whenever an external system references it
|
|
@@ -45,7 +45,7 @@ jobs:
|
|
|
45
45
|
|
|
46
46
|
npx zuplo deploy \
|
|
47
47
|
--api-key "$ZUPLO_API_KEY" \
|
|
48
|
-
--
|
|
48
|
+
--branch "$TAG_NAME"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
This workflow:
|
|
@@ -74,7 +74,7 @@ environments:
|
|
|
74
74
|
run: |
|
|
75
75
|
npx zuplo deploy \
|
|
76
76
|
--api-key "$ZUPLO_API_KEY" \
|
|
77
|
-
--
|
|
77
|
+
--branch main # or your production branch name
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
## With GitHub Releases
|
|
@@ -93,10 +93,12 @@ jobs:
|
|
|
93
93
|
# ... setup steps ...
|
|
94
94
|
|
|
95
95
|
- name: Deploy release
|
|
96
|
+
env:
|
|
97
|
+
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
96
98
|
run: |
|
|
97
99
|
npx zuplo deploy \
|
|
98
100
|
--api-key "$ZUPLO_API_KEY" \
|
|
99
|
-
--
|
|
101
|
+
--branch "$RELEASE_TAG"
|
|
100
102
|
```
|
|
101
103
|
|
|
102
104
|
## Next Steps
|
|
@@ -25,7 +25,9 @@ deploy:
|
|
|
25
25
|
stage: deploy
|
|
26
26
|
script:
|
|
27
27
|
- npm install
|
|
28
|
-
-
|
|
28
|
+
- BRANCH="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_REF_NAME}"
|
|
29
|
+
- npx zuplo deploy --branch "$BRANCH" --api-key "$ZUPLO_API_KEY" 2>&1 | tee
|
|
30
|
+
./DEPLOYMENT_STDOUT
|
|
29
31
|
- echo "DEPLOYMENT_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)'
|
|
30
32
|
./DEPLOYMENT_STDOUT)" >> deploy.env
|
|
31
33
|
artifacts:
|
|
@@ -46,13 +48,17 @@ cleanup:
|
|
|
46
48
|
- test
|
|
47
49
|
script:
|
|
48
50
|
- npm install
|
|
49
|
-
-
|
|
51
|
+
- BRANCH="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_REF_NAME}"
|
|
52
|
+
- npx zuplo delete --branch "$BRANCH" --api-key "$ZUPLO_API_KEY" --wait
|
|
50
53
|
rules:
|
|
51
54
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
52
55
|
```
|
|
53
56
|
|
|
54
|
-
The
|
|
55
|
-
|
|
57
|
+
The deploy job passes `--branch` with the merge request's source branch,
|
|
58
|
+
`CI_MERGE_REQUEST_SOURCE_BRANCH_NAME`, and falls back to `CI_COMMIT_REF_NAME`
|
|
59
|
+
when the pipeline isn't a merge request pipeline. The cleanup job only runs for
|
|
60
|
+
merge request pipelines, deleting the environment by the same branch name after
|
|
61
|
+
tests pass.
|
|
56
62
|
|
|
57
63
|
## Next Steps
|
|
58
64
|
|
|
@@ -25,8 +25,8 @@ deploy-staging:
|
|
|
25
25
|
stage: deploy-staging
|
|
26
26
|
script:
|
|
27
27
|
- npm install
|
|
28
|
-
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
29
|
-
|
|
28
|
+
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch staging 2>&1 | tee
|
|
29
|
+
./DEPLOYMENT_STDOUT
|
|
30
30
|
- echo "STAGING_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)'
|
|
31
31
|
./DEPLOYMENT_STDOUT)" >> staging.env
|
|
32
32
|
artifacts:
|
|
@@ -51,7 +51,7 @@ deploy-production:
|
|
|
51
51
|
- test-staging
|
|
52
52
|
script:
|
|
53
53
|
- npm install
|
|
54
|
-
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --
|
|
54
|
+
- npx zuplo deploy --api-key "$ZUPLO_API_KEY" --branch production
|
|
55
55
|
only:
|
|
56
56
|
- main
|
|
57
57
|
when: manual
|
|
@@ -48,12 +48,8 @@ against the trust store, and only then forwards the request to the target group.
|
|
|
48
48
|
Zuplo Gateway
|
|
49
49
|
</DiagramNode>
|
|
50
50
|
<DiagramGroup id="aws" label="AWS VPC">
|
|
51
|
-
<DiagramNode id="alb"
|
|
52
|
-
|
|
53
|
-
</DiagramNode>
|
|
54
|
-
<DiagramNode id="backend" variant="green">
|
|
55
|
-
Backend targets
|
|
56
|
-
</DiagramNode>
|
|
51
|
+
<DiagramNode id="alb">ALB (mTLS verify)</DiagramNode>
|
|
52
|
+
<DiagramNode id="backend">Backend targets</DiagramNode>
|
|
57
53
|
</DiagramGroup>
|
|
58
54
|
<DiagramEdge from="client" to="gateway" label="HTTPS" />
|
|
59
55
|
<DiagramEdge from="gateway" to="alb" label="mTLS (client cert)" />
|
|
@@ -39,14 +39,14 @@ The Zuplo CLI handles deployment and testing. Azure Pipelines orchestrates your
|
|
|
39
39
|
workflow:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
# Deploy to Zuplo (environment name from branch or --
|
|
42
|
+
# Deploy to Zuplo (environment name from the current branch, or pass --branch)
|
|
43
43
|
npx zuplo deploy --api-key "$ZUPLO_API_KEY"
|
|
44
44
|
|
|
45
45
|
# Run tests against any Zuplo environment
|
|
46
46
|
npx zuplo test --endpoint https://your-env.zuplo.dev
|
|
47
47
|
|
|
48
48
|
# Clean up environments you no longer need
|
|
49
|
-
npx zuplo delete --
|
|
49
|
+
npx zuplo delete --branch my-feature-branch --api-key "$ZUPLO_API_KEY"
|
|
50
50
|
|
|
51
51
|
# Test locally before deploying
|
|
52
52
|
npx zuplo dev # starts local server on port 9000
|
|
@@ -38,14 +38,14 @@ The Zuplo CLI handles deployment and testing. Bitbucket Pipelines orchestrates
|
|
|
38
38
|
your workflow:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
# Deploy to Zuplo (environment name from branch or --
|
|
41
|
+
# Deploy to Zuplo (environment name from the current branch, or pass --branch)
|
|
42
42
|
npx zuplo deploy --api-key "$ZUPLO_API_KEY"
|
|
43
43
|
|
|
44
44
|
# Run tests against any Zuplo environment
|
|
45
45
|
npx zuplo test --endpoint https://your-env.zuplo.dev
|
|
46
46
|
|
|
47
47
|
# Clean up environments you no longer need
|
|
48
|
-
npx zuplo delete --
|
|
48
|
+
npx zuplo delete --branch my-feature-branch --api-key "$ZUPLO_API_KEY"
|
|
49
49
|
|
|
50
50
|
# Test locally before deploying
|
|
51
51
|
npx zuplo dev # starts local server on port 9000
|