Skip to content

Commit

Permalink
Merge pull request #118 from nulib/3590-samconfig-parameter-overrides
Browse files Browse the repository at this point in the history
Update github action to have 'sam deploy' read parameter overrides from .parameter files
  • Loading branch information
bmquinn authored Mar 10, 2023
2 parents 9eb5621 + 7975667 commit 0763146
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ jobs:
role-to-assume: arn:aws:iam::${{ secrets.AwsAccount }}:role/github-actions-role
aws-region: us-east-1
- run: ln -s .tfvars/dc-api/samconfig.toml .
- run: ln -s .tfvars/dc-api/$CONFIG_ENV.parameters .
- run: sam build
- run: |
sam deploy \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--config-env $CONFIG_ENV \
--config-file ./samconfig.toml \
--parameter-overrides HoneybadgerRevision=$HONEYBADGER_REVISION
--parameter-overrides $(while IFS='=' read -r key value; do params+=" $key=$value"; done < ./$CONFIG_ENV.parameters && echo "$params HoneybadgerRevision=$HONEYBADGER_REVISION")
env:
HONEYBADGER_REVISION: ${{ github.sha }}
docs-changed:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,4 @@ $RECYCLE.BIN/
/samconfig.toml
/env.json
/env.*.json
/*.parameters
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ Use the [https-proxy](https://github.com/nulib/aws-developer-environment#conveni
https-proxy start 3002 3000
```

## Deploying the API manually
- Symlink the `*.parameters` file you need from `tfvars/dc-api/` to the application root
- Set your `CONFIG_ENV` and `HONEYBADGER_REVISION` environment variables
- Run `sam deploy`

```sh
# staging environment example:

ln -s ~/environment/tfvars/dc-api/staging.parameters .
CONFIG_ENV=staging
HONEYBADGER_REVISION=$(git rev-parse HEAD)
sam deploy \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--config-env $CONFIG_ENV \
--config-file ./samconfig.toml \
--parameter-overrides $(while IFS='=' read -r key value; do params+=" $key=$value"; done < ./$CONFIG_ENV.parameters && echo "$params HoneybadgerRevision=$HONEYBADGER_REVISION")
```

## Writing Documentation

API documentation is automatically regenerated and deployed on pushes to the staging and production branches. The documentation is in two parts:
Expand Down

0 comments on commit 0763146

Please sign in to comment.