Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support tag based policies #25333

Merged

Conversation

codingdiaz
Copy link
Contributor

@codingdiaz codingdiaz commented Jun 19, 2024

Hey, I just made a Pull Request!

This should address #25232. It looks like the scaffolder action currently defaults to branch based protections. I added a new input to make this a non-breaking change. This could also be implemented by updating the structure of the parameter customBranchPolicyNames (and probably re-naming the input) to be an object. i.e. something like...

protections:
 - name: releases/*
   type: tag

https://docs.github.com/en/rest/deployments/branch-policies?apiVersion=2022-11-28#create-a-deployment-branch-policy

I tested this with a software template that looks like:

apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: v1beta3-demo
  title: Test Action template
  description: scaffolder v1beta3 template demo
spec:
  owner: backstage/techdocs-core
  type: service

  parameters:
    - title: Fill in some steps
      required:
        - name
      properties:
        name:
          title: Name
          type: string
          description: Unique name not used

  # here's the steps that are executed in series in the scaffolder backend
  steps:
    - id: github-env
      name: GitHub Env
      action: github:environment:create
      input:
        repoUrl: github.com?repo=repo-name&owner=owner-name
        name: testing
        token: <redacted>
        deploymentBranchPolicy:
          custom_branch_policies: true
          protected_branches: false
        customTagPolicyNames:
          - releases/*
Screenshot 2024-06-20 at 5 22 55 PM

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Signed-off-by: Christopher Diaz <codingdiaz@icloud.com>
Signed-off-by: Christopher Diaz <codingdiaz@icloud.com>
@codingdiaz codingdiaz requested review from a team as code owners June 19, 2024 19:32
@github-actions github-actions bot added the area:scaffolder Everything and all things related to the scaffolder project area label Jun 19, 2024
@backstage-goalie
Copy link
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/plugin-scaffolder-backend-module-github plugins/scaffolder-backend-module-github minor v0.3.0

Signed-off-by: Christopher Diaz <codingdiaz@icloud.com>
@codingdiaz codingdiaz marked this pull request as ready for review June 20, 2024 21:26
Copy link
Member

@benjdlambert benjdlambert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks! 🙏 🎉

@benjdlambert benjdlambert merged commit b9cc3c9 into backstage:master Jun 24, 2024
25 checks passed
Copy link
Contributor

Thank you for contributing to Backstage! The changes in this pull request will be part of the 1.29.0 release, scheduled for Tue, 16 Jul 2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:scaffolder Everything and all things related to the scaffolder project area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants