Skip to content

feat: Add golang autodiscovery policy support for Gitea/Gitlab/Stash/Bitbucket#49

Merged
olblak merged 7 commits intoupdatecli:mainfrom
olblak:partial/policy/experiment
Jul 11, 2025
Merged

feat: Add golang autodiscovery policy support for Gitea/Gitlab/Stash/Bitbucket#49
olblak merged 7 commits intoupdatecli:mainfrom
olblak:partial/policy/experiment

Conversation

@olblak
Copy link
Member

@olblak olblak commented Jul 3, 2025

This pullrequest is not designed to be merged but as a proof of concept to use the partial feature suggested from
updatecli/updatecli#5508

Description

Test

To test this pull request, you need a custom Updatecli build
based on updatecli/updatecli#5508

Then you can run the following commands:

updatecli manifest show --config updatecli/policies/golang/autodiscovery/updatecli.d/ --values updatecli/policies/golang/autodiscovery/values.yaml --values updatecli/policies/golang/autodiscovery/testdata/values.yaml --debug

Additional Information

Tradeoff

Potential improvement

@AmandaCameron
Copy link

One nit: It'd be nice to have a scm.token_env value for gitea, as there's no standard way to pass a token in. Gitea/forgejo actions both expose a GITHUB_TOKEN env var with a gitea/forgejo token, but it's not valid for writing, or opening PRs, or anything. It's just valid for pulling the repo, so to get write access for opening PRs or similar at the moment, it's required to set a secret and pass it in as an env variable.

@olblak olblak force-pushed the partial/policy/experiment branch from 777a271 to 1b4b124 Compare July 7, 2025 06:50
@olblak olblak changed the title chore: test partial policy feat: Add golang autodiscovery policy support for Gitea/Gitlab/Stash/Bitbucket Jul 7, 2025
@olblak olblak added the enhancement New feature or request label Jul 7, 2025
@olblak olblak force-pushed the partial/policy/experiment branch from 1b4b124 to 676512d Compare July 7, 2025 06:56
@olblak
Copy link
Member Author

olblak commented Jul 7, 2025

@AmandaCameron Could you have another look? It should be good.
If it's fine to you, I can start adding support for other policies as well, if you have a list of policies that you need, I can start with them but it's gonna take me some time

@olblak olblak requested a review from Copilot July 7, 2025 06:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds proof-of-concept support for auto-discovery policies against multiple SCM platforms in Go (Gitea, GitLab, Stash, Bitbucket).

  • Extend values.yaml with scm.kind, env_token, and optional commitusingapi settings.
  • Simplify default template, pin version v0.103.0, and split SCM-specific logic into separate _scm.*.yaml files.
  • Bump policy version to 0.10.0 and update the changelog.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
updatecli/policies/golang/autodiscovery/values.yaml Introduce scm.kind, env_token, and document commit option
updatecli/policies/golang/autodiscovery/updatecli.d/default.tpl Pin template version and simplify SCM condition
updatecli/policies/golang/autodiscovery/updatecli.d/_scm.stash.yaml Add Stash SCM template
updatecli/policies/golang/autodiscovery/updatecli.d/_scm.gitlab.yaml Add GitLab SCM template
updatecli/policies/golang/autodiscovery/updatecli.d/_scm.github.yaml Add GitHub SCM template
updatecli/policies/golang/autodiscovery/updatecli.d/_scm.gitea.yaml Add Gitea SCM template
updatecli/policies/golang/autodiscovery/updatecli.d/_scm.bitbucket.yaml Add Bitbucket SCM template
updatecli/policies/golang/autodiscovery/Policy.yaml Bump policy version from 0.9.0 to 0.10.0
updatecli/policies/golang/autodiscovery/CHANGELOG.md Add 0.10.0 changelog entry
Comments suppressed due to low confidence (2)

updatecli/policies/golang/autodiscovery/values.yaml:10

  • Update the comment to list all supported SCM kinds (github, gitea, gitlab, stash, bitbucket) to keep documentation in sync with the new templates.
  # Accepted values: github, gitea

updatecli/policies/golang/autodiscovery/updatecli.d/_scm.bitbucket.yaml:2

  • The variable name $GitbucketPAT is inconsistent with other SCM templates ($BitbucketPAT). Renaming it to match the pattern would improve consistency.
# {{ $GitbucketPAT := env .scm.env_token }}

@AmandaCameron
Copy link

Sorry for delay getting back, currently on vacation so I've spent a lot of time away from my laptop.

Looks good, the other policies I'd probably be using short-term is forgejo/github actions autodiscovery, as well as updatecli policy updates.

@olblak olblak merged commit 5b9681e into updatecli:main Jul 11, 2025
2 checks passed
@olblak olblak deleted the partial/policy/experiment branch July 11, 2025 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants