Skip to content

Commit

Permalink
Regenerate workflows for external providers weekly (#1187)
Browse files Browse the repository at this point in the history
Pulumi managed providers receive Github Actions workflow changes via a
workflow run in `ci-mgmt`, with changes pushed to the provider
repositories.

External providers need a pull based model to take similar workflow
changes in, hence the creation of the `external-provider` template
folder and adding the required workflow in there.

I tested the contents of the workflow standalone first on a single
provider and it worked fine. Here was the generated PR to update the
workflows:

pulumiverse/pulumi-acme#93
  • Loading branch information
ringods authored Dec 2, 2024
1 parent 9892c9d commit 33f848c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
3 changes: 1 addition & 2 deletions provider-ci/internal/pkg/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func getTemplateDirs(templateName string) ([]string, error) {
return []string{"dev-container", "provider", "pulumi-provider", "bridged-provider"}, nil
case "external-bridged-provider":
// Render more specific templates last to allow them to override more general templates.
return []string{"dev-container", "provider", "bridged-provider"}, nil
return []string{"dev-container", "provider", "external-provider", "bridged-provider"}, nil
default:
return nil, fmt.Errorf("unknown template: %s", templateName)
}
Expand All @@ -119,7 +119,6 @@ func getDeletedFiles(templateName string) []string {
}
case "external-bridged-provider":
return []string{
".github/workflows/resync-build.yml",
"scripts/upstream.sh",
".goreleaser.yml",
".goreleaser.prerelease.yml",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# WARNING: This file is autogenerated - changes will be overwritten when regenerated by https://github.com/pulumi/ci-mgmt
name: "Resync Build Workflows"

on:
schedule:
# 3 AM UTC ~ 8 PM PDT / 7 PM PST every Tuesday.
- cron: 0 3 * * TUE

permissions:
contents: write
pull-requests: write

env:
GITHUB_TOKEN: ${{ secrets.PULUMI_PROVIDER_AUTOMATION_TOKEN || secrets.PULUMI_BOT_TOKEN || secrets.GITHUB_TOKEN }}

jobs:
upgrade_provider:
name: pull-workflow-changes
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# Persist credentials so pull-workflow-changes can push a new branch.
persist-credentials: true
- name: Regenerate the workflow files via https://github.com/pulumi/ci-mgmt
run: |
make ci-mgmt
- name: Create PR (no linked issue)
uses: peter-evans/[email protected]
with:
author: pulumi-bot <[email protected]>
base: main
body: This pull request was generated automatically by the resync-build workflow
in this repository.
branch: chore/resync-${{ github.run_id }}
commit-message: Regenerate workflows for pulumi-#{{ .Config.Provider }}#
committer: pulumi-bot <[email protected]>
labels: impact/no-changelog-required
title: Regenerate Github Actions workflows for pulumi-#{{ .Config.Provider }}#
token: ${{ env.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions provider-ci/test-providers/acme/.github/workflows/resync-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# WARNING: This file is autogenerated - changes will be overwritten when regenerated by https://github.com/pulumi/ci-mgmt
name: "Resync Build Workflows"

on:
schedule:
# 3 AM UTC ~ 8 PM PDT / 7 PM PST every Tuesday.
- cron: 0 3 * * TUE

permissions:
contents: write
pull-requests: write

env:
GITHUB_TOKEN: ${{ secrets.PULUMI_PROVIDER_AUTOMATION_TOKEN || secrets.PULUMI_BOT_TOKEN || secrets.GITHUB_TOKEN }}

jobs:
upgrade_provider:
name: pull-workflow-changes
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# Persist credentials so pull-workflow-changes can push a new branch.
persist-credentials: true
- name: Regenerate the workflow files via https://github.com/pulumi/ci-mgmt
run: |
make ci-mgmt
- name: Create PR (no linked issue)
uses: peter-evans/[email protected]
with:
author: pulumi-bot <[email protected]>
base: main
body: This pull request was generated automatically by the resync-build workflow
in this repository.
branch: chore/resync-${{ github.run_id }}
commit-message: Regenerate workflows for pulumi-acme
committer: pulumi-bot <[email protected]>
labels: impact/no-changelog-required
title: Regenerate Github Actions workflows for pulumi-acme
token: ${{ env.GITHUB_TOKEN }}

0 comments on commit 33f848c

Please sign in to comment.