Skip to content

Commit

Permalink
Automating the test-branch-name job & docs;
Browse files Browse the repository at this point in the history
Updating a number of things here. The test-branch-name is the largest
change. It's now using the folders found in the repository to determine
what the tags are that it should avoid. I've also added the
`milmove-atlantis` tag to the ignorance for the `build` job as well.
Lastly, I've added some documentation that discusses some of the CI/CD
updates so folks understand what all the above is doing for them.
  • Loading branch information
rogeruiz committed Dec 16, 2022
1 parent 4f3c15c commit 29b47cb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ jobs:
test-branch-name:
machine: true
steps:
- checkout
- run:
name: Check for reserved branch names
command: |
if [[ $CIRCLE_BRANCH = latest || $CIRCLE_BRANCH = milmove-app || $CIRCLE_BRANCH = milmove-cypress || $CIRCLE_BRANCH = milmove-infra-tf132 || $CIRCLE_BRANCH = milmove-infra-tf112 ]]; then
echo "Don't use a branch named 'latest', 'milmove-app', 'milmove-cypress', 'milmove-infra-tf112', 'milmove-infra-tf132'; these are meaningful tags."
exit 1
fi
important_branches=( $(ls -d * | grep milmove) latest )
for branch in "${important_branches[@]}"
do
if test "${CIRCLE_BRANCH}" == ${branch}
then
echo "Don't use meaningful tags for a branch name!"
echo "Don't use a branch named ${branch}."
exit 1
fi
done
build:
machine: true
Expand Down Expand Up @@ -82,6 +89,7 @@ workflows:
ignore:
- latest
- milmove-app
- milmove-atlantis
- milmove-cypress
- milmove-infra-tf132
- milmove-infra-tf112
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@ the public domain. In places where it is eligible for copyright, such as some fo
this work is licensed under [the MIT License](https://opensource.org/licenses/MIT), the full text of which is included
in the [LICENSE.txt](./LICENSE.txt) file in this repository.

## CI/CD

This repository uses Workflows to build the containers. The main job is a
`build` job for historical reasons. The workflows filter on certain branches
that match the releases of the Docker images. Branches that get created in this
repository with any of the following names will not build.

* `latest`
* `milmove-app`
* `milmove-cypress`
* `milmove-atlantis`
* `milmove-cypress`
* `milmove-infra-tf112`
* `milmove-infra-tf132`

The main workflow is named `build-containers` and runs `test-branch-name` to
check if the name of the branch matches any of the name of the containers that
get built. Take care naming your branches as if the `test-branch-name` job
fails, it will not allow the `build` command to run which will not allow PRs to
get merged in.

## Images

Each image is specifically tailored.
Expand All @@ -24,6 +45,7 @@ For the latest stable images:
* `milmove/circleci-docker:base`
* `milmove/circleci-docker:milmove-app`
* `milmove/circleci-docker:milmove-cypress`
* `milmove/circleci-docker:milmove-infra-tf112`
* `milmove/circleci-docker:milmove-infra-tf132`
* `milmove/circleci-docker:milmove-atlantis`

Expand Down

0 comments on commit 29b47cb

Please sign in to comment.