Skip to content

Commit

Permalink
test: renovate reusable workflow (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
JossWhittle authored Jun 11, 2024
1 parent f495de4 commit d2f574f
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 13 deletions.
11 changes: 11 additions & 0 deletions .github/renovate.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,15 @@ module.exports = {
],

// Rest of the config goes here...
hostRules: [
// Add a set of credentials for accessing docker or oci helm registries like harbor.
// These registry tokens should be read-only, they only need to be able to look up
// what versions are available. Pretty much all our repos will need this config!
{
hostType: "docker",
domainName: process.env.RENOVATE_HARBOR_REGISTRY,
username: process.env.RENOVATE_HARBOR_USER,
password: process.env.RENOVATE_HARBOR_TOKEN
},
]
};
54 changes: 54 additions & 0 deletions .github/workflows/internal-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Internal Container

on:
pull_request:
# Only consider PRs that change files for this asset, including ci scripts
paths:
- '.github/workflows/internal-container.yaml'
- 'containers/internal/**'
# Make sure all workflows that are "required checks" for a given
# branch protection rule have the same paths: and branches-ignore:
# filters. Otherwise, you can end up in a deadlock waiting on a
# required check that will never be executed.
push:
# Only release off of release and maintenance branches for this asset
branches:
- 'maintenance/internal-container/[0-9]+.x.x'
- 'maintenance/internal-container/[0-9]+.[0-9]+.x'
- 'main'
# Only consider pushes that change files for this asset, including ci scripts
paths:
- '.github/workflows/internal-container.yaml'
- 'containers/internal/**'

permissions:
contents: write
pull-requests: write
actions: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel early on pull requests if new commits are added,
# Don't cancel on release pushes
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
# Job name must be unique across repo to target
# branch protection rules "required checks" properly!
internal-container:
uses: SwanseaUniversityMedical/workflows/.github/workflows/pr-and-release-container.yaml@v2.0.1-containers
with:
job-name: internal-container
comment-pr: "true"
comment-release: "true"
registry: ${{ vars.HARBOR_REGISTRY }}
registry-user: ${{ vars.HARBOR_USER }}
registry-repo: ${{ vars.HARBOR_PROJECT }}/internal
release-tag-format: 'v${version}-internal-container'
cosign-public-key: ${{ vars.COSIGN_PUBLIC_KEY }}
build-file: containers/internal/Dockerfile
build-context: containers/internal
secrets:
cosign-private-key: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosign-password: ${{ secrets.COSIGN_PASSWORD }}
registry-token: ${{ secrets.HARBOR_TOKEN }}
19 changes: 6 additions & 13 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: Renovate Bot

on:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 * * * *'

permissions:
actions: write
contents: write
issues: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
Expand All @@ -22,12 +17,10 @@ jobs:
group: heavy

steps:
- name: clone repo
uses: actions/checkout@v4

- name: renovate
uses: renovatebot/github-action@v40.1.12
- uses: SwanseaUniversityMedical/workflows/.github/actions/renovate@feat/renovate
with:
configurationFile: .github/renovate.js
token: ${{ secrets.RENOVATE_TOKEN }}
env-regex: "^(?:RENOVATE_\\w+|LOG_LEVEL|\\w+_PROXY)$"
env:
RENOVATE_HARBOR_REGISTRY: ${{ vars.HARBOR_REGISTRY }}
RENOVATE_HARBOR_USER: ${{ secrets.HARBOR_USER }}
RENOVATE_HARBOR_TOKEN: ${{ secrets.HARBOR_TOKEN }}
1 change: 1 addition & 0 deletions containers/internal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM harbor.ukserp.ac.uk/github-workflows-test/controller:7.1.0

0 comments on commit d2f574f

Please sign in to comment.