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

Add support to change main branch on bootstrap and pipelines repositories #508

Merged
merged 2 commits into from
Aug 31, 2022

Conversation

sbkok
Copy link
Collaborator

@sbkok sbkok commented Aug 31, 2022

Why?

We set a goal to remove the word master from our repository as much as possible. The bootstrap repository initialized to the master branch by default and creates pull requests against the master branch too.

Additionally, the CodePipeline should monitor the correct branch to perform the changes required when the main branch gets updated.

What?

For any new installation, the bootstrap repository should default to the main branch.

While any existing installation of ADF should allow the administrators to move to the main branch easily.
To enable this, when ADF is updated, it will perform a check which branch is configured as the default branch on the repository (aws-deployment-framework-bootstrap and aws-deployment-framework-pipelines). It will create the pull request against the default branch if it needs to be updated.

If you want to switch from one branch to another, you need to create a new branch from the current default branch.

For example, switching from master to main:
Simply running these commands from inside the aws-deployment-framework-bootstrap or aws-deployment-framework-pipelines repository that is cloned locally should do it:

git fetch
git checkout origin/master
git push HEAD:origin/main

Navigate to the CodeCommit repository and update the default branch of the repository to the new branch. Make sure to click the Save button underneath the default branch setting to save it.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

sbkok added 2 commits August 31, 2022 08:57
**Why?**

We set a goal to remove the word `master` from our repository as much as
possible. The bootstrap repository initialized to the `master` branch by
default and creates pull requests against the `master` branch too.

Additionally, the CodePipeline should monitor the correct branch to
perform the changes required when the main branch gets updated.

**What?**

For any new installation, the bootstrap repository should default to the
`main` branch.

While any existing installation of ADF should allow the administrators
to move to the `main` branch easily.
To enable this, when ADF is updated, it will perform a check which branch is
configured as the default branch on the repository (adf-bootstrap and
adf-pipelines). It will create the pull request against the default branch if it
needs to be updated.

If you want to switch from one branch to another,
you need to create a new branch from the current default branch.

For example, switching from `master` to `main`:
Simply running these commands from inside the
`aws-deployment-framework-bootstrap` repository that is cloned locally
should do it:

```bash

git fetch
git checkout origin/master
git push HEAD:origin/main
```

Navigate to the CodeCommit repository and update the default branch of the
repository to the new branch. Make sure to click the `Save` button underneath
the default branch setting to save it.
Apply default branch determination logic to the ADF-pipelines repository too.
@sbkok sbkok added this to the v3.2.0 milestone Aug 31, 2022
@sbkok sbkok requested review from javydekoning and StewartW August 31, 2022 07:02
@sbkok
Copy link
Collaborator Author

sbkok commented Aug 31, 2022

PS another PR will be created shortly that will update the docs to update the language to be more inclusive.
Like updating usage of the master account to management account, etc.

Copy link
Contributor

@StewartW StewartW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Good use of custom resources.

Copy link
Contributor

@javydekoning javydekoning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Echoing what @StewartW said, nice improvement. My only concern is the amount of extra code to maintain to support this.

@sbkok sbkok merged commit 7dd6280 into awslabs:master Aug 31, 2022
@sbkok sbkok deleted the feat/use-default-branch-in-adf-cc-repos branch August 31, 2022 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants