Esgn/clean docker build - #104
Draft
esgn wants to merge 7 commits into
Draft
Conversation
Member
Member
Author
Member
Author
|
@naulan-chrzaszcz les problèmes de permissions et de nommage fou du repo devraient être réglés. Je te laisse trouver comment le casser à nouveau. |
zhak5388
reviewed
May 7, 2025
| @@ -0,0 +1,28 @@ | |||
| name: Build Docker image for checkcing purposes | |||
Contributor
There was a problem hiding this comment.
Suggested change
| name: Build Docker image for checkcing purposes | |
| name: Build Docker image for checking purposes |
Non?
Contributor
Member
Author
There was a problem hiding this comment.
Je continue de creuser alors qu'il ne faudrait pas ;)
Tag docker
- La définition de ce à quoi doit ressembler un tag docker est en fait ici https://pkg.go.dev/github.com/distribution/reference et est donc
[\w][\w.-]{0,127}version Golang. A noter qu'en Go\wne matche pas les caractères ASCII étendus. Bref unéne passera pas à la différence d'un[a-z]ensedavec la locale par défaut sur les distribs classiques (avecLC_ALL=Con se rapproche du comportement de\w). Bref, on a la règle de validation du tag pour une image docker.
Branch name
- Côté git on peut s'appuyer là dessus pour valider le nom d'une branche https://git-scm.com/docs/git-check-ref-format . En pratique cela fait pas mal de règles différentes à respecter et c'est somme toute assez permissif. On peut avoir une branche nommée
%ou%20sans que cela pose de problème. - GitHub semble suivre la ligne définie par Git (encore heureux). En passant par l'interface web, les caractères interdits (genre
*) sont automatiquement supprimés du nom de la branche. Bref, on peut visiblement s'en tenir à la règle de nommage git.
On résume
- On peut facilement créer des noms de branches qui ne valideront pas
[\w][\w.-]{0,127}. On peut tenter de remplacer dans le nom de la branche les caractères hors[\w.-]par un autre caractère mais celui-ci devrait matcher[\w]si on veut être tout à fait rigoureux => Une seule possibilité, remplacer par des_ - Ce remplacement n'empêchera pas les collisions entre tags ou la production de tags assez moches. Typiquement l'exemple de @zhak5388
y45é_+ldeviendraity45___l. On doit même pouvoir se lancer dans le one line ascii art en étant joueur. - Bref, tout ca ressemble de plus en plus à de la geekerie pathologique. Ce qui serait éventuellement plus intéressant serait de pouvoir définir une regexp pour imposer une règle de nommage de branche sur un dépot. Si je continue de m'énerver sur le sujet je vais aller voir du côté des git hook.
J'ai poussé une nouvelle version de la désinfection des chaines de caractères au passage.
Member
Author
There was a problem hiding this comment.
Co-authored-by: zhak5388 <102757175+zhak5388@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








I've closed the former pull request. I'm reopening a draft one after having changed approach.
I've spent a bit of time on this and I think I have a slightly better understanding of github workflows now. All in all, and if I'm not mistaken, GitHub is not opensource and feature requests for many useful small features for CI/CD are still pending (ex : here or there). I'm still astonished by the fact the registry must be cleaned from a workflow (using an action which, at the end of the day, is nothing more than a client of the REST and GraphQL GitHub APIs).
Here is what we are aiming at for the Docker workflow.
In order to do all of this, my current solution is to use a
docker.ymlworkflow which calls all the necessary workflows (workflow_call). I'm not sure it will please everyone but it opens the possibility to reuse the workflow files and keeps things clear, at least for me.To try and summarize :
github.ref_name) and image name todocker-build-push.ymland it builds and pushes the Docker image using these inputs. I'm finally usingdocker/metadata-actiononly for generating automatic labels. I'm building the tag name using a shell command : We will need the tag name for the delete branch image workflow. This delete branch image workflow will run on the default branch (see here) and we cannot tell metadata-action where to get the branch name from. Keeping the tag generation out of metadata-action makes things easier. At the end ofdocker-build-push.ymlwe're callingdocker-registry-cleanup.ymlto remove the untagged image we've created.docker.ymland calldocker-build-push.ymlwith the correct branch name (this time it'sgithub.event.ref). Frankly it's not vital to create image on branch creation, but while I was as it I wanted to see how this could be done.docker-delete-branch-image.ymlwith branch_name (github.event.ref) as input. This workflow will generate a tag in the same fashion thatdocker-build-push.ymland we're using an action to delete the tag name from the registry.Remarks