-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Introduces a new (alternative) behavior for dockerfile
with a Simple Text Matcher/Replacer
#176
Conversation
90c709b
to
d639798
Compare
Thanks for the PR, while I haven't had the time to test it yet, I definitely understand that the first attempt to automate Dockerfile is not ideal and I really appreciate this different approach. |
ec15846
to
f1ae800
Compare
2c67e37
to
4676423
Compare
…ent instead fully-fledged parsing Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
da18028
to
cd03adc
Compare
Hello @olblak 👋 As we discussed together, this PR is not aiming at removing the previous behavior. The code had been updated to manage automatically the kind of parsing to be done:
I still need to polish this PR (mainly around logrus messages), but 80% of the work has been done an you can start reviewing to have an idea. |
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
2b2fe56
to
e64ce47
Compare
dockerfile
with a Simple Text Matcher/Replacer
While testing this PR, I realised how the examples are outdated and now in a broken state |
I spotted a regression, in a condition or target, with the moby syntax, if we set the key "value" to something that doesn't exist it returns a stacktrace
With version : "0.0.36", it returns
with the latest it returns
|
…pdatecli#176 Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
7ffc5d3
to
602e68d
Compare
With the following configuration: ``` source: name: Get Latest mirrorbits release version kind: githubRelease spec: owner: "etix" repository: "mirrorbits" token: {{ requiredEnv "CUSTOM_GH_TOKEN" }} username: dduportal version: latest conditions: isENVSet: name: Is the 2nd ENV instruction having a "keyword" set to "MIRRORBIT_VERSION" kind: dockerfile spec: file: Dockerfile Instruction: "ENV[0][0]" Value: "MIRRORBITS_VERSION" scm: github: user: "olblak" email: "updatecli@olblak.com" owner: "olblak" repository: "mirrorbits" token: {{ requiredEnv "CUSTOM_GH_TOKEN" }} username: "olblak" branch: "master" ``` the result of the command line `./bin/updateCli diff --config ./bin/config.yml.tpl` is: ``` DIFF +++++++++++ + PREPARE + +++++++++++ Cloning git repository: https://github.com/olblak/mirrorbits.git in /var/folders/2s/09szbrgn22l2tcvxz1_k34g40000gn/T/updatecli/olblak/mirrorbits Enumerating objects: 99, done. Counting objects: 100%!((MISSING)99/99), done. Compressing objects: 100%!((MISSING)72/72), done. Total 99 (delta 43), reused 62 (delta 21), pack-reused 0 Fetching remote branches +++++++ + RUN + +++++++ SOURCE: ======= ✔ 'latest' github release version founded: v0.5.1 CHANGELOG: ========== Release published on the 2018-11-23 12:25:27 +0000 UTC at the url https://github.com/etix/mirrorbits/releases/tag/v0.5.1 - Sort the mirrors by the last state date in the list command - Regression: mirrors were not able to transition between up and down states CONDITIONS: =========== 🐋 On (Docker)file "/var/folders/2s/09szbrgn22l2tcvxz1_k34g40000gn/T/updatecli/olblak/mirrorbits/Dockerfile": ✗ Instruction "ENV[0][0]" found but incorrectly set to "MIRRORBIT_VERSION" instead of "MIRRORBITS_VERSION" ============================= REPORTS: ✗ CONFIG.YML Source: ✔ Get Latest mirrorbits release version(githubRelease) Condition: ✔ Is the 2nd ENV instruction having a "keyword" set to "MIRRORBIT_VERSION"(dockerfile) Target: ERROR: ✗ 1/1 job(s) failed ERROR: command failed ``` Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
602e68d
to
a2749d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Just dropping by, feel free to disregard :)
5147263
to
6eaabfb
Compare
…ted but valid keyword Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
Signed-off-by: Olivier Vernin <olivier@vernin.me>
Signed-off-by: Olivier Vernin <olivier@vernin.me>
Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
dbf3645
to
53a7006
Compare
This PR is an attempt (and a proposal) to fix #136 .
dockerfile
plugin referenced as "Simple Text":ARG
:FROM
:The previous behavior is kept as it: the plugin
dockerfile
detects automatically if the configuration iteminstructions:
receives a string (previous behavior referenced as "Moby Parser") or with a map (new behavior "Simple Text Parser").Implementation is now having an interface of a
DockerfileParser
, with 2 implementations:mobyparser
(previous behavior) orsimpletextparser
(new behavior)dockerfile
to handle the initialization of a parser based on the YAML config:--- Initial message, for historical reason.
It's work in progress but I'm opening it to give you an idea and validate the concept.
The idea is to get rid of the fully fledged
Dockerfile
Moby's parser, and use textual replacement instead, to avoid loosing theDockerfile
's comment and structure (line returns, etc.).FROM
andARG
instructions as first step (ENV
andLABEL
are coming soon, the other will depend on your validation)matcher
is currently implemented with astrings.Hasprefix
. It could be changed into a "startsWith:" keyword. I did it quick and dirty but there is room for improvement hereWDYT @olblak ?