diff --git a/.github/workflows/change-file-in-pr.yml b/.github/workflows/change-file-in-pr.yml new file mode 100644 index 00000000..46b3dc2c --- /dev/null +++ b/.github/workflows/change-file-in-pr.yml @@ -0,0 +1,30 @@ +name: Change File Included in PR + +on: + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + check-files-in-directory: + if: ${{ !contains(github.event.pull_request.labels.*.name, 'Release Not Needed') && !contains(github.event.pull_request.labels.*.name, 'Release PR') }} + name: Change File Included in PR + runs-on: ubuntu-latest + + steps: + - name: Checkout PR code + uses: actions/checkout@v3 + + - name: Get List of Changed Files + id: changed-files + uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf #v45 + + - name: Check for Change File(s) in .autover/changes/ + run: | + DIRECTORY=".autover/changes/" + if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "$DIRECTORY"; then + echo "✅ One or more change files in '$DIRECTORY' are included in this PR." + else + echo "❌ No change files in '$DIRECTORY' are included in this PR." + echo "Refer to the 'Adding a change file to your contribution branch' section of https://github.com/aws/aws-dotnet-deploy/blob/main/CONTRIBUTING.md" + exit 1 + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 914e0741..99b16399 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,51 @@ To send us a pull request, please: GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). +## Adding a `change file` to your contribution branch + +Each contribution branch should include a `change file` that contains a changelog message for each project that has been updated, as well as the type of increment to perform for those changes when versioning the project. + +A `change file` looks like the following example: +```json +{ + "Projects": [ + { + "Name": "AWS.Deploy.CLI", + "Type": "Patch", + "ChangelogMessages": [ + "Fixed an issue causing a failure somewhere" + ] + } + ] +} +``` +The `change file` lists all the modified projects, the changelog message for each project as well as the increment type. + +These files are located in the repo at .autover/changes/ + +You can use the `AutoVer` tool to create the change file. You can install it using the following command: +``` +dotnet tool install -g AutoVer +``` + +You can create the `change file` using the following command: +``` +autover change --project-name "AWS.Deploy.CLI" -m "Fixed an issue causing a failure somewhere +``` +Note: Make sure to run the command from the root of the repository. + +You can update the command to specify which project you are updating. +The available projects are: +* AWS.Deploy.CLI +* AWS.Deploy.Recipes.CDK.Common +* AWS.Deploy.ServerMode.Client + +The possible increment types are: +* Patch +* Minor +* Major + +Note: You do not need to create a new `change file` for every changelog message or project within your branch. You can create one `change file` that contains all the modified projects and the changelog messages. ## Finding contributions to work on Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. diff --git a/test/AWS.Deploy.CLI.IntegrationTests/Helpers/IAMHelper.cs b/test/AWS.Deploy.CLI.IntegrationTests/Helpers/IAMHelper.cs index 15758cb9..2c85a94c 100644 --- a/test/AWS.Deploy.CLI.IntegrationTests/Helpers/IAMHelper.cs +++ b/test/AWS.Deploy.CLI.IntegrationTests/Helpers/IAMHelper.cs @@ -32,6 +32,19 @@ public async Task DeleteRoleAndInstanceProfileAfterBeanstalkEnvionmentDeployment var role = existingRoles.FirstOrDefault(x => string.Equals(roleName, x.RoleName)); if (role != null) { + var polices = (await _client.ListAttachedRolePoliciesAsync(new ListAttachedRolePoliciesRequest { RoleName = roleName })).AttachedPolicies; + if (polices != null) + { + foreach(var policy in polices) + { + await _client.DetachRolePolicyAsync(new DetachRolePolicyRequest + { + RoleName = roleName, + PolicyArn = policy.PolicyArn + }); + } + } + await _client.RemoveRoleFromInstanceProfileAsync(new RemoveRoleFromInstanceProfileRequest { RoleName = roleName, @@ -78,6 +91,12 @@ await _client.CreateRoleAsync(new CreateRoleRequest AssumeRolePolicyDocument = assumeRolepolicyDocument.Replace("'", "\""), MaxSessionDuration = 7200 }); + + await _client.AttachRolePolicyAsync(new AttachRolePolicyRequest + { + RoleName = roleName, + PolicyArn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier" + }); } InstanceProfile instanceProfile = null;