Skip to content

Commit b16fa86

Browse files
authored
feat: GHA, trunk and renovate updates (#34)
## what - Renovate updates: - Added github-actions manager - Grouped TF and GHA updates to reduce noise (see [the docs](https://docs.renovatebot.com/noise-reduction/)) - Configured to merge minor GHA updates automatically - TF and major GHA updates require review - Test GHA updates: - Switched to reusable GHA - Trunk Upgrade updates: - Added a step to merge the PR automatically with a native GH tooling (see [the recommendations from community](https://github.com/peter-evans/enable-pull-request-automerge?tab=readme-ov-file#usage)). - GitHub CLI (gh) is pre-installed on ubuntu-latest. - `--auto` enables auto-merge, waiting until all required checks have passed. - GitHub App already has appropriate permissions: `contents: write`, `pull-requests: write` ## why - This is a desired behaviour. ## references - https://masterpoint.slack.com/archives/C04MUCKUDKK/p1746468817883509 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated dependency management configuration to improve automation for GitHub Actions and Terraform updates, including enhanced grouping and labeling of update PRs. - Simplified the test workflow by consolidating multiple steps into a single action for Terraform and Tofu testing. - Enhanced the trunk upgrade workflow to automatically merge upgrade pull requests when applicable. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 1086f94 commit b16fa86

File tree

3 files changed

+44
-68
lines changed

3 files changed

+44
-68
lines changed

.github/renovate.json5

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
"config:best-practices",
44
"github>aquaproj/aqua-renovate-config#2.7.5"
55
],
6-
"schedule": [
7-
"after 9am on the first day of the month"
8-
],
9-
"assigneesFromCodeOwners": true,
10-
"dependencyDashboardAutoclose": true,
11-
"addLabels": [
12-
"auto-upgrade"
13-
],
146
"enabledManagers": [
15-
"terraform"
7+
"terraform",
8+
"github-actions"
169
],
1710
"terraform": {
1811
"ignorePaths": [
@@ -23,34 +16,49 @@
2316
"\\.tofu$"
2417
]
2518
},
19+
"schedule": [
20+
"after 9am on the first day of the month"
21+
],
22+
"assigneesFromCodeOwners": true,
23+
"dependencyDashboardAutoclose": true,
24+
"addLabels": ["{{manager}}"],
2625
"packageRules": [
2726
{
28-
"matchDepTypes": [
29-
"optionalDependencies"
30-
],
31-
// Allow auto merge if it's not a major version update
32-
"matchUpdateTypes": [
33-
"minor",
34-
"patch",
35-
"pin",
36-
"digest"
37-
],
38-
"automerge": true
27+
"matchManagers": ["github-actions"],
28+
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
29+
"automerge": true,
30+
"automergeType": "branch",
31+
"groupName": "github-actions-auto-upgrade",
32+
"addLabels": ["auto-upgrade"]
33+
},
34+
{
35+
"matchManagers": ["github-actions"],
36+
"matchUpdateTypes": ["major"],
37+
"groupName": "github-actions-needs-review",
38+
"addLabels": ["needs-review"]
39+
},
40+
{
41+
"matchManagers": ["terraform"],
42+
"groupName": "tf",
43+
"addLabels": ["needs-review"]
3944
},
4045
{
4146
"matchFileNames": ["**/*.tofu", "**/*.tf"],
4247
"matchDatasources": ["terraform-provider", "terraform-module"],
43-
"registryUrls": ["https://registry.opentofu.org"]
48+
"registryUrls": ["https://registry.opentofu.org"],
49+
"groupName": "tf"
4450
},
4551
{
4652
"matchFileNames": ["**/*.tofu"],
4753
"matchDepTypes": ["required_version"],
48-
"registryUrls": ["https://registry.opentofu.org"]
54+
"registryUrls": ["https://registry.opentofu.org"],
55+
"groupName": "tf"
4956
},
5057
{
5158
"matchFileNames": ["**/*.tf"],
5259
"matchDepTypes": ["required_version"],
53-
"registryUrls": ["https://registry.terraform.io"]
60+
"registryUrls": ["https://registry.terraform.io"],
61+
"groupName": "tf"
5462
}
5563
]
5664
}

.github/workflows/test.yaml

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ permissions:
1313
id-token: write
1414
pull-requests: read
1515

16-
env:
17-
AWS_REGION: us-east-1
18-
1916
jobs:
2017
tf-test:
2118
name: 🧪 ${{ matrix.tf }} test
@@ -24,46 +21,8 @@ jobs:
2421
matrix:
2522
tf: [tofu, terraform]
2623
steps:
27-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
29-
- name: Aqua Cache
30-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
31-
if: ${{ !github.event.act }} # Don't enable the cache step if we're using act for testing
24+
- uses: masterpointio/github-action-tf-test@c3b619f3bca9e4f482b9e0fb3166ab3f02d9d54c # v1.0.0
3225
with:
33-
path: ~/.local/share/aquaproj-aqua
34-
key: v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('aqua.yaml')}}
35-
restore-keys: |
36-
v1-aqua-installer-${{runner.os}}-${{runner.arch}}-
37-
38-
- name: Install Aqua
39-
uses: aquaproj/aqua-installer@5e54e5cee8a95ee2ce7c04cb993da6dfad13e59c # v3.2.1
40-
with:
41-
aqua_version: v2.48.1
42-
43-
- name: Aqua Install
44-
shell: bash
45-
run: aqua install --tags ${{ matrix.tf }}
46-
47-
- name: Check if TF AWS provider is used
48-
id: check_aws_provider
49-
run: |
50-
if grep -q "aws" $(find . -name "versions.tf" -o -name "versions.tofu" -type f); then
51-
echo "Found aws in versions.tf or versions.tofu files"
52-
echo "contains_hashicorp=true" >> $GITHUB_OUTPUT
53-
else
54-
echo "No versions.tf or versions.tofu files contain aws"
55-
echo "contains_hashicorp=false" >> $GITHUB_OUTPUT
56-
fi
57-
58-
# Assume into the `masterpoint-testing` AWS account with OIDC for testing ONLY if the AWS provider is used
59-
# Not needed for modules that don't use the AWS provider, for example, exclusive Spacelift modules
60-
- name: Configure AWS Credentials on `masterpoint-testing` AWS Account
61-
if: steps.check_aws_provider.outputs.contains_hashicorp == 'true'
62-
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
63-
with:
64-
role-to-assume: arn:aws:iam::115843287071:role/mp-ue1-testing-oidc-github
65-
role-session-name: GitHubActionsOIDC-MP-Infra-Repo
66-
aws-region: ${{ env.AWS_REGION }}
67-
68-
- run: ${{ matrix.tf }} init
69-
- run: ${{ matrix.tf }} test
26+
tf_type: ${{ matrix.tf }}
27+
aws_role_arn: ${{ vars.TF_TEST_AWS_ROLE_ARN }}
28+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/trunk-upgrade.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ jobs:
2727
private_key: ${{ secrets.MP_BOT_APP_PRIVATE_KEY }}
2828

2929
- name: Upgrade
30+
id: trunk-upgrade
3031
uses: trunk-io/trunk-action/upgrade@4d5ecc89b2691705fd08c747c78652d2fc806a94 # v1.1.19
3132
with:
3233
github-token: ${{ steps.generate-token.outputs.token }}
3334
reviewers: "@masterpointio/masterpoint-internal"
3435
prefix: "chore: "
36+
37+
- name: Merge PR automatically
38+
if: steps.trunk-upgrade.outputs.pull-request-number != ''
39+
env:
40+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
41+
PR_NUMBER: ${{ steps.trunk-upgrade.outputs.pull-request-number }}
42+
run: |
43+
gh pr merge "$PR_NUMBER" --squash --auto --delete-branch

0 commit comments

Comments
 (0)