Skip to content

Commit b6e712e

Browse files
committed
docs: improve documentation regarding ECR dev-release
1 parent d133327 commit b6e712e

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

docs/artifact-types/aws-ecr.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,16 @@ It also uses OIDC to assume an IAM role and access CodeArtifact in read-only mod
131131

132132
## dev-release
133133

134-
ECR supports [dev-release](../features/dev-release.md): Docker image gets published with tag equal to branch name
135-
(branch name `feature/login` becomes ECR tag `feature-login`).
136-
`agilecustoms/release` action enforces branch name prefix (configured via `dev-branch-prefix`, default is `feature/`).
137-
On the other hand, the ECR supports lifecycle rules by tag prefix.
138-
So if you apply both — you can be sure that all self-service artifacts are removed automatically in a few days!
139-
140-
There is one important gotcha: you can't re-run dev-release for immutable ECR repo:
141-
- immutable ECR repo prevents pushing image for an existing tag
142-
- tag can be deleted, but IAM doesn't allow to configure permissions selectively for tag prefix,
143-
so if you allow deleting tags — it is a risk that a developer can remove some non-dev tag
144-
- if you make ECR repo mutable — it is a risk that a developer can override a non-dev tag
145-
146-
So if you need to re-run dev-release shortly (before old tag expired), the workaround is just to create a new branch:
147-
`feature/login` -> `feature/login-2` and run dev-release from it
134+
`agilecustoms/release` supports ECR [dev-release](../features/dev-release.md):
135+
Docker image gets published with tag equal to branch name (branch name `feature/login` becomes ECR tag `feature-login`).
136+
137+
ECR has two great features:
138+
- immutable repo with exclusions
139+
- support lifecycle rules by tag prefix
140+
141+
`agilecustoms/release` action enforces branch name prefix (configured via `dev-branch-prefix`, default is `feature/`)
142+
143+
Combine all together:
144+
- you can allow your dev team to make dev-releases from `feature/` branches
145+
- developers can re-run dev-release workflow on the same branch if needed, because ECR repo is immutable with exclusion for `feature-*` tags
146+
- corresponding images will be automatically removed thanks to lifecycle rules by tag prefix, so you don't worry about overspending on ECR storage

docs/features/dev-release.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The table below shows a comparison of different release types:
3434
Dev release allows publishing artifacts temporarily for testing purposes:
3535
you push your changes to the feature branch, the branch name becomes this dev-release version:
3636
- SemVer is _not_ generated
37-
- no automated pushes, so no need for PAT
37+
- no automated git pushes, so no need for PAT
3838
- no git tags created, files in branch addressable by branch name
3939
- `/` gets replaced with `-`, so branch `feature/login` gives version `feature-login`
4040
- parameter `dev-branch-prefix` (default value is `feature/`) enforces branch naming for dev releases.
@@ -113,14 +113,18 @@ Artifact types that support dev-release:
113113

114114
## Security
115115

116+
_Note: here we assume you use a centralized AWS account for storing artifacts: files in S3, images in ECR
117+
and (less popular) software packages in CodeArtifact. Lets call such account a Distribution or "Dist" account.
118+
You create and store an artifact once (in the Dist account) and then deploy/use in any workload (dev, test, prod) account_
119+
116120
Dev-release mode brings self-service capabilities but also brings security risks
117121

118122
_You can't guarantee dev-release security if anybody can assume your 'ci/publisher' role.
119123
Or if anybody can use powerful GH PAT to make arbitrary Git changes and then run a malicious workflow on the main branch.
120124
In this section we assume you already have a secure GitHub setup and AWS authorization, see [Authorization and security](../authorization.md)_
121125

122126
Now lets focus on risks coming specifically from dev-release. Developers may try to use dev-release workflow to:
123-
1. _Create_ unverified artifact that looks like normal
127+
1. _Create_ an unverified artifact that looks like normal
124128
2. _Update_ (override) existing production artifact
125129
3. _Delete_ production artifact
126130

@@ -155,7 +159,7 @@ For `ci/publisher` role you might think you need to trust only protected branche
155159
But in GitHub if a workflow uses an environment — it takes precedence in OIDC token,
156160
so on AWS side instead of "trust main branch" you would need to configure "trust release environment" type of trust policy.
157161
See [terraform-aws-ci-publisher](https://github.com/agilecustoms/terraform-aws-ci-publisher) for trust policy examples.
158-
See [GitHub Authorization](../authorization.md#github-authorization-and-security) why environment is needed in the first place
162+
See [GitHub Authorization](../authorization.md#github-authorization-and-security) why GH "environment" is needed in the first place
159163

160164
## Risk analysis
161165

@@ -179,7 +183,7 @@ What can a malicious developer do?
179183

180184
### S3 Risks
181185

182-
Feature branch name is used as suffix for dev-release artifacts, so `ci/publisher-dev` can only put objects at path `mycompany-dist/*/feature*`
186+
Feature branch name is used as suffix for dev-release artifacts, so `ci/publisher-dev` can only put objects at path `mycompany-dist/*/feature*`.
183187
Imagine a software product which release consists of multiple files like this:
184188
```
185189
<bucket>/myservice/v1.2.3/

0 commit comments

Comments
 (0)