Deploying a branch
The teams below have been assigned a space in which they can host a specific branch of the web platform on the staging environment. If you would like a space allocated for your team, please ask within the web platform team's channel on ms teams.
The deployment of the branch is automated via Gitlab CI/CD. Please read below on how this is achieved.
| Team | Branch name | URL |
|---|---|---|
| Private Client | cf-private-client | http://loginstg.secure.investec.com/branches/cf-private-client/* |
| Programmable Banking | cf-programmable-banking | http://loginstg.secure.investec.com/branches/cf-programmable-banking/* |
Cloudflare worker
apps/app-platform-pc/app-platform-pc-gitlab-ci.yml
.initiate Template
.deploy-branch:
stage: deploy
image: $WRANGLER_IMAGE_URL
script:
- npm i
- npx ng build --project $TARGET_PROJECT --base-href /$CI_COMMIT_BRANCH/ -c staging
- node io-resources/cloudflare/assets-to-json.js $CI_COMMIT_BRANCH $TARGET_PROJECT
- CF_API_TOKEN=$CLOUDFLARE_API_TOKEN_WORKERS wrangler kv:bulk put --namespace-id=a69ab55d152d47a394291358796d7ba3 bundle.json
- echo "Branch deployed, visit https://loginstg.secure.investec.com/$CI_COMMIT_BRANCH/ to view your branch"
Tip
Your branch name must match one of the whitelisted branches above
Example extending .initiate
programmable-banking-deploy-branch:
extends: .deploy-branch
only:
changes: [ apps/app-platform-pc/**/* ]
refs:
- /^cf-programmable-banking\/.*/
variables:
TARGET_PROJECT: app-platform-pc
The branch's web assets are stored in Cloudflare key/value storage under the namespace of the branch (e.g. __web-platform-cf-private-client-workers_sites_assets). The key of a web asset being the file name and the value being the contents of the file.
A Cloudflare worker maps incoming http requests on a specific route (e.g. loginstg.secure.investec.com/branches/cf-private-client/*) to the relevant key within the KV storage and renders the value as the appropriate mime type (e.g. text/html).
Gitlab pipeline
The pipeline will trigger if there are changes within the "enabled" branches, as defined in the gitlab ci file (deploy-cf->only..). This will execure a stanging bundle and deploy once compiled.