From 7305ea79f930f07dafa48fa211259e4d12b094d5 Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Wed, 29 May 2024 19:26:12 -0700 Subject: [PATCH] Allow Renovate to run Earthly Actually install it in the Renovate container, not the runner environment. Also, run make rather than earthly on release branches. Signed-off-by: Nic Cope --- .github/renovate-entrypoint.sh | 7 +++++ .github/renovate.json5 | 49 +++++++++++++++++++++++++++------- .github/workflows/renovate.yml | 9 +++---- 3 files changed, 50 insertions(+), 15 deletions(-) create mode 100755 .github/renovate-entrypoint.sh diff --git a/.github/renovate-entrypoint.sh b/.github/renovate-entrypoint.sh new file mode 100755 index 000000000..193ebbcd6 --- /dev/null +++ b/.github/renovate-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +curl -fsSLo /usr/local/bin/earthly https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 +chmod +x /usr/local/bin/earthly +/usr/local/bin/earthly bootstrap + +runuser -u ubuntu renovate diff --git a/.github/renovate.json5 b/.github/renovate.json5 index cad1b6966..1f5d13bef 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -99,10 +99,12 @@ // be at the beginning, high priority at the end "packageRules": [ { - "description": "Generate code after upgrading go dependencies", + "description": "Generate code after upgrading go dependencies (master)", "matchDatasources": [ "go" ], + // Currently we only have an Earthfile on master. + matchBaseBranches: ["master"], postUpgradeTasks: { // Post-upgrade tasks that are executed before a commit is made by Renovate. "commands": [ @@ -115,10 +117,30 @@ }, }, { - "description": "Lint code after upgrading golangci-lint", + "description": "Generate code after upgrading go dependencies (release branch)", + "matchDatasources": [ + "go" + ], + // Currently we only have an Earthfile on master. + matchBaseBranches: ["release-.+"], + postUpgradeTasks: { + // Post-upgrade tasks that are executed before a commit is made by Renovate. + "commands": [ + "make go.generate", + ], + fileFilters: [ + "**/*" + ], + executionMode: "update", + }, + }, + { + "description": "Lint code after upgrading golangci-lint (master)", "matchDepNames": [ "golangci/golangci-lint" ], + // Currently we only have an Earthfile on master. + matchBaseBranches: ["master"], postUpgradeTasks: { // Post-upgrade tasks that are executed before a commit is made by Renovate. "commands": [ @@ -131,13 +153,22 @@ }, }, { - "matchManagers": [ - "crossplane" - ], - "matchFileNames": [ - "test/e2e/**" + "description": "Lint code after upgrading golangci-lint (release branch)", + "matchDepNames": [ + "golangci/golangci-lint" ], - "groupName": "e2e-manifests", + // Currently we only have an Earthfile on master. + matchBaseBranches: ["release-.+"], + postUpgradeTasks: { + // Post-upgrade tasks that are executed before a commit is made by Renovate. + "commands": [ + "make go.lint", + ], + fileFilters: [ + "**/*" + ], + executionMode: "update", + }, }, { "description": "Ignore non-security related updates to release branches", @@ -220,4 +251,4 @@ "groupName": "golang version", } ], -} +} \ No newline at end of file diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index b1390ff79..799766699 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -27,12 +27,6 @@ jobs: - name: Checkout uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - - name: Setup Earthly - uses: earthly/actions-setup@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - version: ${{ env.EARTHLY_VERSION }} - # Don't waste time starting Renovate if JSON is invalid - name: Validate Renovate JSON run: npx --yes --package renovate -- renovate-config-validator @@ -55,3 +49,6 @@ jobs: with: configurationFile: .github/renovate.json5 token: '${{ steps.get-github-app-token.outputs.token }}' + mount-docker-socket: true + docker-user: root + docker-cmd-file: .github/renovate-entrypoint.sh