Skip to content

Commit

Permalink
Merge pull request #888 from aws/dev
Browse files Browse the repository at this point in the history
Sync dev and main
  • Loading branch information
96malhar authored Dec 10, 2024
2 parents 5ed05e5 + 1326513 commit c4b7866
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/change-file-in-pr.yml
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions test/AWS.Deploy.CLI.IntegrationTests/Helpers/IAMHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c4b7866

Please sign in to comment.