Skip to content

Commit

Permalink
Merge branch 'main' into tferns-noscript-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tferns authored Jan 17, 2024
2 parents b04e352 + a878410 commit f346298
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 48 deletions.
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,3 @@ Pre-requite for running smoke test are:
5. yarn install

More details are on [Smoke Tests](./smoke-tests/README.md)

## Copilot Initialisation

Copilot is the deployment of the infrastructure configuration, which is all stored under the copilot folder. The manifest files have been pre-generated by running through various initialisation steps that create the manifest files by prompting a series of questions, but do not _deploy_ the infrastructure.

For each AWS account, these commands will need to be run _once_ to initialise the environment:

`copilot app init pre-award` - this links the pre-award app with the current service, and associates the next commands with the service. Essentially, this provides context for the service to run under

```
copilot init \
--name fsd-form-runner \
--app pre-award \
--type 'Load Balanced Web Service' \
--image "ghcr.io/${{github.repository_owner}}"/runner \
--port 80
```

This will initalise this service, using the current created image
65 changes: 36 additions & 29 deletions README_DLUHC.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
This file describes the GitHub Actions workflow in use for the [DLUHC Fork](https://github.com/communitiesuk/digital-form-builder) of the [XGovFormBuilder](https://github.com/XGovFormBuilder/digital-form-builder).
# DLUHC Fork of Digital Form Builder

# Versioning
This respository contains the [DLUHC Fork](https://github.com/communitiesuk/digital-form-builder) of the [XGovFormBuilder](https://github.com/XGovFormBuilder/digital-form-builder).

The DLUHC workflow to build and push images uses a manual versioning approach. When merging to main, make sure to update the `VERSION` env var in [dluhc-build-and-publish.yml](https://github.com/communitiesuk/digital-form-builder/blob/fs-1263-publish-fork/.github/workflows/dluhc-build-and-publish.yml)
General information for working with the form builder in DLUHC and getting your local workspace setup can be found [here](https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/41124236/Working+with+the+form-builder)

# Builds and Deploys

Information on how the form-runner is built and deploy to AWS is contained [here](https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/73695505/How+do+we+deploy+our+code+to+prod#Deploying-Form-Builder). Note the process is different to the other applications in Access Funding and requires manual steps - pushing to git alone will not deploy anything anywhere.

# Using a new version of the DLUHC fork

Expand Down Expand Up @@ -35,6 +39,8 @@ If just updating the forms (no files within the runner itself) you can just do a

# Workflow Files

More detail on the workflow for deploying form runner to AWS is available [here](https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/73695505/How+do+we+deploy+our+code+to+prod#Deploying-Form-Builder)

## .github/workflows/dluhc-build-and-publish.yml

This is the main workflow file for changes made in the DLUHC fork. On every push to any branch it will:
Expand All @@ -46,44 +52,45 @@ This is the main workflow file for changes made in the DLUHC fork. On every push
- Tag both images with `latest`
- Tag the repo with the current version number, as defined by the `VERSION` env var in [this file](https://github.com/communitiesuk/digital-form-builder/blob/fs-1263-publish-fork/.github/workflows/dluhc-build-and-publish.yml).

## .github/workflows/dluhc-build-and-deploy-with-forms.yml
## .github/workflows/main--lint-unit-build-and-publish-images.yml

There are 2 docker images involved in creating our deployed image of the form runner.
**Disabled** This is the workflow used on the main branch of the original XGovFormBuilder repo. It does not apply to our workflow.

[Digital Form Builder DLUHC Runner](https://github.com/communitiesuk/digital-form-builder/pkgs/container/digital-form-builder-dluhc-runner)
This is the image created from our fork of the form runner at https://github.com/communitiesuk/digital-form-builder. It is the base image of what is deployed to PaaS (see below) but does not contain our form_jsons.
## .github/workflows/branch--lint-unit-and-smoke-test.yml

Every push of our fork creates a new image, tagged with the commit ID. Pushes to main of our fork create a new image tagged with `latest`. The github action trigger ignores pushes to [FSD configuration](./fsd_config/). Pushes of our fork do not automatically redeploy the form runner with our forms - to do this you must manually trigger [Build and Deploy with Forms](./.github/workflows/dluhc-build-and-deploy-with-forms.yml). The form runner base images can be used in fsd_config/Dockerfile to test branch changes.
Runs against a branch that has an open pull request against it. It will execute on every push to such a branch to build and run smoke tests. Unchanged from upstream repo.

[Funding Service Design Frontend Runner](https://github.com/communitiesuk/digital-form-builder/pkgs/container/runner)
This is the image we deploy to PaaS. It uses the [Dockerfile](./fsd_config/Dockerfile) to create the image, which takes the `Digital Form Builder DLUHC Runner` image as the base image, and imports the `form_jsons` from this repo over the top to produce our custom form runner image.
## ./github/workflows/increment-version.yml

This image is built, pushed and deployed by [Build and Deploy Forms](./.github/workflows/dluhc-build-and-deploy-with-forms.yml). That workflow is manually triggered, it does not automatically trigger on an update of the form runner base image.
- Triggered when a PR is opened (or re-opened)
- Finds the latest tag in the repo, increments the patch version of this, then updates [version](./version) with that new version
- eg. If the latest tag is `1.2.3`, `version` will be updated to `VERSION=1.2.4`
- This version is then used to tag the built image, as explained [above](#githubworkflowsdluhc-build-and-publishyml) and [here](https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/73695505/How+do+we+deploy+our+code+to+prod#Build-the-DLUHC-Runner-Image)

## .github/workflows/main--lint-unit-build-and-publish-images.yml
## ./github/workflows/copilot_deploy.yml

**Disabled** This is the workflow used on the main branch of the original XGovFormBuilder repo. It does not apply to our workflow.
- Deploys the form runner to AWS as per [this wiki page](https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/73695505/How+do+we+deploy+our+code+to+prod#Build-and-deploy-the-Runner-Image)
- Uses the image build by [dluhc-build-and-publish](#githubworkflowsdluhc-build-and-publishyml) to create a deployable docker image, then pushes this to AWS.

## .github/workflows/branch--lint-unit-and-smoke-test.yml
# IDE Setup

Runs against a branch that has an open pull request against it. It will execute on every push to such a branch to build and run smoke tests. Unchanged from upstream repo.
[pre-commit](https://github.com/communitiesuk/funding-service-design-workflows/blob/main/readmes/python-repos-ide-setup.md#pre-commit)

## Extras
# Copilot Initialisation

This repo comes with a .pre-commit-config.yaml, if you wish to use this do
the following while in your virtual enviroment:
Copilot is the deployment of the infrastructure configuration, which is all stored under the copilot folder. The manifest files have been pre-generated by running through various initialisation steps that create the manifest files by prompting a series of questions, but do not _deploy_ the infrastructure.

# set up virtual enviroment
python -m venv .venv
source .venv/Scripts/activate
For each AWS account, these commands will need to be run _once_ to initialise the environment:

# Install pre-commit
pip install pre-commit
pre-commit install
`copilot app init pre-award` - this links the pre-award app with the current service, and associates the next commands with the service. Essentially, this provides context for the service to run under

Once the above is done you will have autoformatting (trailing-whitespace, end-of-file-fixer and check-ast) built
into your workflow. You will be notified of any errors during commits.
```
copilot init \
--name fsd-form-runner \
--app pre-award \
--type 'Load Balanced Web Service' \
--image "ghcr.io/${{github.repository_owner}}"/runner \
--port 80
```

### `detect-secrets` hook
We use this pre-commit hook to prevent new secrets from entering the code base.(For more info: https://github.com/Yelp/detect-secrets)
- If the hook detects false positives, mark with an inline `pragma: allowlist secret` comment to ignore it.
This will initalise this service, using the current created image
3 changes: 3 additions & 0 deletions fsd_config/form_jsons/cof/cy/gwybodaeth-am-yr-ased-cof.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@
{
"path": "/darparu-gwasanaeth-lleol-cNfGYA",
"condition": "nlbrNc"
},
{
"path": "/darparu-gwasanaeth-lleol-JcqzLI"
}
],
"section": "wxYZcT"
Expand Down
3 changes: 3 additions & 0 deletions fsd_config/form_jsons/cof/en/asset-information-cof.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,9 @@
{
"path": "/local-service-provision-cNfGYA",
"condition": "nlbrNc"
},
{
"path": "/local-service-provision-JcqzLI"
}
],
"section": "wxYZcT"
Expand Down

0 comments on commit f346298

Please sign in to comment.