mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 02:24:21 -05:00
[Actions] Globally resolvable action names #10869
Closed
opened 2025-11-02 09:20:33 -06:00 by GiteaMirror
·
46 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
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c1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#10869
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @silverwind on GitHub (May 18, 2023).
Issue
Currently when using this on gitea.com:
It will resolve to instance-specific URL
https://gitea.com/actions/setup-pythonwhich I see very problematic because it makes action names ambigous across multiple gitea instances and github itself (where this will work).Proposal
If the action URL is not absolute, assume a hardcoded
https://github.com/prefix, just like podman and docker assume adocker.io/prefix on images not having a fully qualified name. This will ensure that action names are unambigously resolvable globally.@delvh commented on GitHub (May 18, 2023):
https://docs.gitea.com/administration/config-cheat-sheet#actions-actions
DEFAULT_ACTIONS_URL?@ChristopherHX commented on GitHub (May 18, 2023):
I actually wish that
DEFAULT_ACTIONS_URL(app.ini) is an array instead of a string.With default value APP_URL (host your own actions via relative syntax), (
https://gitea.com,The last time I checked it was a place with mostly outdated copies of github),
https://github.com@silverwind commented on GitHub (May 18, 2023):
The option is good but it must not be an option, it needs to be hardcoded to ensure it stays globally resolveable. So the proposal is to remove this configurability and hardcode it to
https://github.com/.If it can not be removed, at least make the default
https://github.com/so that users can destroy the global resolution on their instances themselves.@delvh commented on GitHub (May 18, 2023):
No.
Give me a reason for reopening.
@delvh commented on GitHub (May 18, 2023):
That is not a good idea.
@delvh commented on GitHub (May 18, 2023):
okay, I can understand that.
Should we reopen this issue as that, or open a separate issue for it?
@ChristopherHX commented on GitHub (May 18, 2023):
Seems like I misunderstood the intention of this issue, my proposal should be a separate issue then.
However in both scenarios is
actions/setup-python@v4resolveable by default. So I thought that might be related.@silverwind commented on GitHub (May 18, 2023):
Looking closer at podman, it actually has a config that seems to default to:
From that, I take it could be possible to define multiple search prefixes and I would suggest a default of
["https://github.com"], with those URLs checked in sequence. I would not recommend adding the current instance at the end by default, as it would break global resolution if the value is anything but the single Github URL.@ChristopherHX commented on GitHub (May 18, 2023):
The default is hardcoded to
https://gitea.com, it is only the instance-specific url if Gitea Actions is hosted on https://gitea.com. For myself it is still https://gitea.com even if the instance is *.home@silverwind commented on GitHub (May 18, 2023):
Yeah, I understand that it's set
gitea.comon all instances. That's better than current instance, but still not globally resolvable.I would set to
github.comin all my instances and I would strongly suggest the default to be adjusted to that. GitHub Actions does not support this prefix syntax, so the only way for workflows to be portable in the github -> gitea direction is with the proposed default.@ChristopherHX commented on GitHub (May 18, 2023):
Yes, I also think github.com is a better default than gitea.com.
I have modded my own actions_runner for gitea actions to look also on github.com to find actions.
@lunny commented on GitHub (May 18, 2023):
I don't think github.com is better than gitea.com. Because some actions may need to be changed which cannot be used directly by Gitea. i.e. All actions which depend on GitHub APIs which Gitea APIs doesn't compatible will be run failed. For those actions, we need to fork and adjust them.
Considering 3 different Gitea instances.
1 Public Gitea instances
2 Private network Gitea instances that could connect to Internet.
3 Private network Gitea instances that cannot connect to Internet.
To satisfy all three situations, a configurable item is necessary.
And of course, if we can support multiple sites(less than 3), maybe it's better.
For 1 and 2, it could use
localhost, gitea.com, github.comFor 3, it could use
localhost@silverwind commented on GitHub (May 18, 2023):
Maybe we can have a vote:
https://github.com["https://github.com", "https://gitea.com"]https://gitea.comMy option preference is 1 > 2, while 3 is unacceptable to me.
@lunny commented on GitHub (May 18, 2023):
Please read my comment above.
@silverwind commented on GitHub (May 18, 2023):
Yes, but fork them under a new name so that
actions/foounambiguosly refers to the action on github whilehttps://gitea.com/actions/foorefers to the one one gitea. This is how it works in docker where image namefooessentially always refers todocker.io/foo, and not another registry.If we could convince GitHub to support a prefix, those actions would be even runnable (if compatible) on github.com.
@silverwind commented on GitHub (May 18, 2023):
This is a valid concern, and a
https://localhostentry would be need to set there, but it should not be the default.@lunny commented on GitHub (May 18, 2023):
👍 Could I vote
["https://gitea.com", "https://github.com"]? So that we can override some non-compatible actions in github.com. Users' workflows could run both successes without changes.@silverwind commented on GitHub (May 18, 2023):
While not ideal,
["https://gitea.com", "https://github.com"]for the default seems like an acceptable compromise to me which will satisfy most scenarios.@silverwind commented on GitHub (May 18, 2023):
I think we could extend
DEFAULT_ACTIONS_URLwith a comma syntax as comma is unlikely to appear in an URL, e.g.Trailing slash should be stripped while parsing the setting and subsequent URL join should be with
/.@silverwind commented on GitHub (May 19, 2023):
I think we should also put out a recommendation to always use FQANs (fully qualified action names), eliminiating any ambiguity on where the action is hosted, e.g.
instead of the ambiguous
We should also push github to support the FQAN syntax, as currently it's not possible to use actions hosted anywhere else than github.
@silverwind commented on GitHub (May 19, 2023):
Another idea that comes to mind: docker images names omit the
https://prefix, and I think this is something worth considering too. I think it should be possible to enforce that all actions should be hosted onhttpsonly, e.g. nohttp. This benefits both security and is less to type.@yardenshoham commented on GitHub (May 19, 2023):
Yes, that also feels more like docker
@silverwind commented on GitHub (May 19, 2023):
Should be easy to accept all three forms:
@ChristopherHX commented on GitHub (May 19, 2023):
Allowing this is dangerous in my opinion (it has been proposed like this already)
Then you need a very smart parser to parse
<domain>/<owner/<repository>/<path>@<version><owner/<repository>/<path>@<version>github actions syntax, path can contain multiple/or omitted@silverwind commented on GitHub (May 19, 2023):
Ah, didn't know that action can be in subdirectories of a repo, yes that makes it ambiguous to parse, so probably don't support that variant.
@silverwind commented on GitHub (Jun 23, 2023):
I was toying with the idea of making updates support updating actions to latest versions locally, but given that the
DEFAULT_ACTIONS_URLmechanism makes action URLs ambigous depending on instance configuration, it'll break in cases whenDEFAULT_ACTIONS_URLis nothttps://github.combecauseDEFAULT_ACTIONS_URLis only resolved at the Gitea server, not the user's machine.So I still strongly recommend we:
DEFAULT_ACTIONS_URLtohttps://github.comby default, or even better, eliminate the option it completely so instances can not be configured to resolve action names ambigouslyThis will ensure that when/if Gitea actions becomes popular, action names will always be unambigous globally and users can seamlessly share actions between GitHub and Gitea instances. It will require a bit more verbose syntax, but I think it's only for the better:
actions/checkout@v3to refer to the github.com actionhttps://gitea.com/actions/checkout@v3to refer to the gitea.com actionhttps://codeberg.org/actions/checkout@v3to refer to the codeberg.org action@silverwind commented on GitHub (Jun 23, 2023):
So I would propose the following course of actions:
DEFAULT_ACTIONS_URLtohttps://github.comin the next versionDEFAULT_ACTIONS_URLin the runner in the next versionDEFAULT_ACTIONS_URLin the runner in the following versionThe minor inconvenience of adding
https:/gitea.comto all action names is meager in comparison to breaking the nascent actions ecosystem as a whole. Without this change, GitHub's runner would not be able to resolve gitea-hosted actions.@lunny commented on GitHub (Jun 23, 2023):
I don't think runner support
DEFAULT_ACTIONS_URL?@wolfogre commented on GitHub (Jun 25, 2023):
I agree with @silverwind. We had to use
DEFAULT_ACTIONS_URLbecause the act runner did not supportuses: https://gitea.com/xxxat first, but now, the confusion it brings is greater than the convenience it brings.@techknowlogick commented on GitHub (Jun 25, 2023):
This sounds like a reasonable approach to me too
@silverwind commented on GitHub (Jun 26, 2023):
Is it a gitea-only setting and gitea communicates the absolute URL to the runner?
da6df0d063/modules/setting/actions.go (L16)I think we should get
DEFAULT_ACTIONS_URL=https://github.cominto v1.21, and likely document for v1.20 that the default will change next version. Then maybe deprecate the setting in v1.22 or later, but no pressure on that one.@wolfogre commented on GitHub (Jun 29, 2023):
I find a very strong reason to make some changes for
DEFAULT_ACTIONS_URL. It's about security so we will talk about it in private.@silverwind Discord please.
@silverwind commented on GitHub (Jun 29, 2023):
Don't have time right now, but will check it later there.
@silverwind commented on GitHub (Jun 29, 2023):
One niceity we can allow ommitting the protocol, so
github.comprefix is equal tohttps://github.cometc. It saves a bit of typing and is still unambiguous because after the URL origin, theuser/repoformat is always to strings separated by/. This is also how docker does it, but I'm of the opinion we should support both with and without protocol.@wolfogre commented on GitHub (Jun 29, 2023):
I understand, that's what I thought at the beginning, but unfortunately GitHub Actions already support
uses: x/y/z, andzmeans sub folder, likeuse: actions/cache/restore@v3.So it's tricky to distinguish between
host/user/repoanduser/repo/folder.Update:
Maybe we could and a leading
/like/host/user/repo, but it could mislead users because it's easy to think that the leading '/' means nothing or it's just a typo.@yardenshoham commented on GitHub (Jun 29, 2023):
docker treats it as a host if it has
.or:, otherwise it's a user@wolfogre commented on GitHub (Jun 29, 2023):
Not ideal for this, what if
https://gitea.com/test.com/test?@yardenshoham commented on GitHub (Jun 29, 2023):
It'll be the action
test.com/testfrom thehttps://gitea.cominstance@silverwind commented on GitHub (Jun 29, 2023):
Unfortunatly, gitea allows usernames with
., making it ambigous again with hostname. I think we should forbid.in at least new usernames.FTR: Github forbids
.in username. Reference. I would even go as far as adopt that regex in gitea.@wolfogre commented on GitHub (Jun 29, 2023):
.is not the point (although it is a "point" 😂). Even though GitHub/Gitea/GitLab/GitXX all forbid.in usernames, users can still use use custom git server which we never heard to host actions, right?And it is also possible for hostname not to contain
., what iflocalhostor others hostnames definded in/etc/hosts? And the service names indocker-compose.yamlare available hostnames@yardenshoham commented on GitHub (Jun 29, 2023):
You'd do something like
localhost:80@ChristopherHX commented on GitHub (Jun 29, 2023):
I want to note that only act and it's derviates clone actions via git.
actions/runner downloads tar / zip archives via api after asking the GitHub Instance where it is located (GitHub also applies an allowed repository filter and sends a token to authorized private actions for private repos), which is faster than a full unshallow git clone on a microSD
Also the git only server would have to follow the
<owner>/<repo>pattern, I saw some using a completly different url path and wouldn't work either way.Since port 80 is http by default, would this mean like docker it contact the server via http and switch after a redirect to https? I thought that the outcome was strict https for short notation
Same question, not everyone uses https within docker compose.
Eventually you have to fallback to the http/https notation in these cases.
@wolfogre commented on GitHub (Jun 29, 2023):
To be clear, I agree with any solution that can shorten the path of actions, as long as:
schema://host/user/namestill works, so that the user can still make it clear. And it is also possible to support more schemas, such asfile://.host/user/namemeansdefault_schema://host/user/name, but if the host does not contain., you must add the port to the host.Unfortunately, I cannot figure out a solution to omit protocol if the format is
x/y/z.@ghnp5 commented on GitHub (Jul 16, 2023):
Hey!
I believe I understand why this change was made, and I'm happy to keep the default to "github".
However, I'd like to understand whether this means I should prefer the GitHub Actions instead of Gitea Actions, when referring to
uses:.For example, you mirrored a few actions, such as
checkout.Is it OK to use GitHub's version instead of Gitea's version?
Also, there are several actions in the marketplace that use the Octokit library, which I always believed I should avoid those, because they only work for GitHub and not Gitea, am I correct to say that?
I'm just wondering how "safe" it is to default to GitHub, hoping that I will never use an action from GitHub by accident, that could potentially damage my repos or Gitea instance, due to incompatibilities (when Gitea's mirror version would be more compatible).
Apologies if something of what I said above doesn't make sense :)
Thank you!
@wolfogre commented on GitHub (Jul 17, 2023):
IIRC, yes, the mirror is just a mirror.
Not really, of course the Octokit library is designed for GitHub not Gitea, however, Gitea has a certain degree of compatibility with GitHub, so I would say that most actions can be used on Gitea, even though they are developed based on Octokit. However, I cannot guarantee that all actions will be compatible. We are also working on identifying incompatible actions and making them compatible, but you know, it's a big task.
@ghnp5 commented on GitHub (Jul 17, 2023):
Thank you very much for your reply @wolfogre
That's really great to know that actions using Octokit are actually safe to use on Gitea!
I was trying to avoid any of those, so far :)
Absolutely - I understand!
My question above was not at all intending to be a bad criticism - it was just asking for clarification.
The work you guys have done for Gitea Actions is outstanding. Well done, really!
I've just submitted another donation. I absolutely love what you do 🧡