Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre commit to remove issue number check #1210

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<!-- The title of this PR should complete the sentence: β€œMerging this PR will ...” -->

## :memo: Summary
This PR closes/completes/contributes to issue #ANPL-...
<!-- Adding the issue number above will automatically link it to our Jira board -->
This PR resolves ...
<!-- Adding the issue number above will automatically link the PR to the github issue,
and will close the issue on merging. Note this will only happen if the correct keyword
is used, such resolves/closes/fixes. See full list of keywords at
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword.
If the issue belongs to the current repo, add the number prefixed with e.g #1234.
If the issue belongs to another repo, add with Organization_name/Repository#... e.g.
ministryofjustice/data-platform#1234 -->

This PR ...
<!-- Give a brief description here.
<!-- Give a brief description here.
What changes have you made?
Is it a version bump, bugfix, documentation, major change, something else? -->

Expand All @@ -27,4 +33,4 @@ Merging this PR will have the following side-effects:
<!-- If documentation is left until later, you must explain why and create a ticket for it -->
- [ ] No changes to the documentation are required
- [ ] This PR includes all relevant documentation
- [ ] Documentation will be added in the future because ... (see #ANPL-...)
- [ ] Documentation will be added in the future because ... (see issue #...)
9 changes: 0 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,3 @@ repos:
- id: flake8
name: flake8 format check
entry: bash -c 'flake8 --config=.flake8 $(git diff --name-only --cached --diff-filter=ACMR | grep .py)'

- repo: local
hooks:
- id: jira-ticket
name: Check for Jira ticket
language: pygrep
entry: '\A(?!ANPL+-[0-9]+)'
args: [--multiline]
stages: [commit-msg]
28 changes: 8 additions & 20 deletions doc/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,19 @@ and then ask a colleague for help.

## Run the app

**Assumption**:
**Assumption**:
- You have completed your local env setup by following the above sections.
- we use aws with sso login, the name of profile for our aws dev account is `admin-dev-sso`

### Local AWS profile setup (on first run only)
This app needs to interact with AWS account.
The AWS resources like IAM, s3 buckets are under our dev account and will be managed by
app through [boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html).
app through [boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html).
In order to make sure the boto3 can obtain the right profile for local env.

#### using aws-cli directly

Check your `.aws/config`, the profile `admin-dev-sso` should look like below
Check your `.aws/config`, the profile `admin-dev-sso` should look like below

```ini
[profile admin-dev-sso]
Expand All @@ -296,7 +296,7 @@ __NOTES__ boto3 doesn't recognise `sso_session` and it will fail to retrieve the
`.aws/sso/cache` folder if you mix above setting with `sso_session` together.

#### using aws-vault
If you use aws-vault to manage your aws credential, then the profile should look like
If you use aws-vault to manage your aws credential, then the profile should look like

```ini
[profile sso-default]
Expand Down Expand Up @@ -385,15 +385,15 @@ Or with Gunicorn WSGI server:
```sh
gunicorn -b 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker -w 4 controlpanel.asgi:application
```
if you use `aws-vault` to manage the aws-cli, then you need put `aws-vault exec <profile_name e.g. admin-dev-sso> -- `
before the above command e.g.
if you use `aws-vault` to manage the aws-cli, then you need put `aws-vault exec <profile_name e.g. admin-dev-sso> -- `
before the above command e.g.
```sh
aws-vault exec admin-dev-sso -- python3 manage.py runserver
```
If the AWS session token is expired, you will be redirected to auth-flow to refresh the session token automatically

if you choose not using `aws-vault`, then in order to reduce the chance of getting sesion_token expiration during
debugging, make sure you run the following command in advance
if you choose not using `aws-vault`, then in order to reduce the chance of getting sesion_token expiration during
debugging, make sure you run the following command in advance
```sh
aws sso login --profile <profile_name e.g. admin-dev-sso>
```
Expand Down Expand Up @@ -444,19 +444,7 @@ Current checks are:-
- `black` library (formats Python code)
- `isort` library (standardises the order of Python imports)
- `flake8` library (formats Python code and also improves code style)
- Jira ticket reference (commits must reference the ticket number)

To override the above for whatever reason (maybe you don't have a ticket number and because you are working on hotfix) you can use the following command.

`PRE_COMMIT_ALLOW_NO_CONFIG=1 git push ...`

### Git commit message

Commit messages should follow the appropriate format.
All commits must begin with the Jira ticket they are associated with.

format: `ANPL-[int]`

e.g.

`git commit -m "ANPL-1234 insert message here"`