Gitlab and placing hidden key scripts into include filesHow can I include a YAML file inside another?How do we use the 'variables' keyword in gitlab-ci.yml?Using Gitlab deploy keys with write accessGitLab CI Script variablesInclude multiple files in Gitlab MarkdownWay to let runner execute a bash scriptGitlab-ci: extend script sectionSelf-hosting gitlab autodeploy to aws ec2 serverHow does Gitlab's “pages” job work internally?Need advice with gitLab-runner for continuous deployment
bldc motor, esc and battery draw, nominal vs peak
How to write a column outside the braces in a matrix?
Implications of cigar-shaped bodies having rings?
Aligning equation numbers vertically
How to have a sharp product image?
How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?
What's the polite way to say "I need to urinate"?
Is the claim "Employers won't employ people with no 'social media presence'" realistic?
"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?
Phrase for the opposite of "foolproof"
555 timer FM transmitter
How come there are so many candidates for the 2020 Democratic party presidential nomination?
If a planet has 3 moons, is it possible to have triple Full/New Moons at once?
Aliens crash on Earth and go into stasis to wait for technology to fix their ship
Pulling the rope with one hand is as heavy as with two hands?
Is there any official lore on the Far Realm?
How to stop co-workers from teasing me because I know Russian?
Don’t seats that recline flat defeat the purpose of having seatbelts?
Which big number is bigger?
How can I practically buy stocks?
Get consecutive integer number ranges from list of int
Why must Chinese maps be obfuscated?
How did Captain America manage to do this?
Re-entry to Germany after vacation using blue card
Gitlab and placing hidden key scripts into include files
How can I include a YAML file inside another?How do we use the 'variables' keyword in gitlab-ci.yml?Using Gitlab deploy keys with write accessGitLab CI Script variablesInclude multiple files in Gitlab MarkdownWay to let runner execute a bash scriptGitlab-ci: extend script sectionSelf-hosting gitlab autodeploy to aws ec2 serverHow does Gitlab's “pages” job work internally?Need advice with gitLab-runner for continuous deployment
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have what amounts to several different scripts that I want to run in a variety of stages across multiple projects. Currently they are of the form:
.hidden_key: &hidden_key |
do_something
do_something_else
real_job:
script:
- *hidden_key
Effectively .hidden_key
is a function I use throughout the .gitlab-ci.yml
file and across several projects this way. But I can't seem to get the include to work when I move .hidden_key
into a file and include it like this:
include:
- remote: https://gitlab/project/master/raw/hidden_key.yml
real_job:
script:
- *hidden_key
When I do that, gitlab complains about:
Error: Unknown alias: hidden_key
Am I doing something incorrectly, or is this an actual limitation of includes (and therefore not supported) ?
What alternatives to this are there to clean up my .gitlab-ci.yml
file ?
gitlab yaml aliases
add a comment |
I have what amounts to several different scripts that I want to run in a variety of stages across multiple projects. Currently they are of the form:
.hidden_key: &hidden_key |
do_something
do_something_else
real_job:
script:
- *hidden_key
Effectively .hidden_key
is a function I use throughout the .gitlab-ci.yml
file and across several projects this way. But I can't seem to get the include to work when I move .hidden_key
into a file and include it like this:
include:
- remote: https://gitlab/project/master/raw/hidden_key.yml
real_job:
script:
- *hidden_key
When I do that, gitlab complains about:
Error: Unknown alias: hidden_key
Am I doing something incorrectly, or is this an actual limitation of includes (and therefore not supported) ?
What alternatives to this are there to clean up my .gitlab-ci.yml
file ?
gitlab yaml aliases
add a comment |
I have what amounts to several different scripts that I want to run in a variety of stages across multiple projects. Currently they are of the form:
.hidden_key: &hidden_key |
do_something
do_something_else
real_job:
script:
- *hidden_key
Effectively .hidden_key
is a function I use throughout the .gitlab-ci.yml
file and across several projects this way. But I can't seem to get the include to work when I move .hidden_key
into a file and include it like this:
include:
- remote: https://gitlab/project/master/raw/hidden_key.yml
real_job:
script:
- *hidden_key
When I do that, gitlab complains about:
Error: Unknown alias: hidden_key
Am I doing something incorrectly, or is this an actual limitation of includes (and therefore not supported) ?
What alternatives to this are there to clean up my .gitlab-ci.yml
file ?
gitlab yaml aliases
I have what amounts to several different scripts that I want to run in a variety of stages across multiple projects. Currently they are of the form:
.hidden_key: &hidden_key |
do_something
do_something_else
real_job:
script:
- *hidden_key
Effectively .hidden_key
is a function I use throughout the .gitlab-ci.yml
file and across several projects this way. But I can't seem to get the include to work when I move .hidden_key
into a file and include it like this:
include:
- remote: https://gitlab/project/master/raw/hidden_key.yml
real_job:
script:
- *hidden_key
When I do that, gitlab complains about:
Error: Unknown alias: hidden_key
Am I doing something incorrectly, or is this an actual limitation of includes (and therefore not supported) ?
What alternatives to this are there to clean up my .gitlab-ci.yml
file ?
gitlab yaml aliases
gitlab yaml aliases
edited Mar 22 at 18:08
Anthon
32.8k1798152
32.8k1798152
asked Mar 22 at 17:21
pllpll
1612
1612
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This is almost certainly a limitation of the includes (which would have been much better implemented explicitly with a tag).
Standard YAML loading consists of a parse, a compose and a construction phase. The aliases get resolved during the compose phase, and anchors e.g. do not carry over to the next document in multi-document YAML file.
Althoug the include
key might be interpreted as early the construction phase (but that might also happen after completing that phase, interpreting the resulting data structure), then the alias in the including YAML will already need to have been resolved during its compose phase.
You will have more luck using some templating system jinja2, for which you can of course populate the variable to be substituted from your YAML file with common stages as well.
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304806%2fgitlab-and-placing-hidden-key-scripts-into-include-files%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is almost certainly a limitation of the includes (which would have been much better implemented explicitly with a tag).
Standard YAML loading consists of a parse, a compose and a construction phase. The aliases get resolved during the compose phase, and anchors e.g. do not carry over to the next document in multi-document YAML file.
Althoug the include
key might be interpreted as early the construction phase (but that might also happen after completing that phase, interpreting the resulting data structure), then the alias in the including YAML will already need to have been resolved during its compose phase.
You will have more luck using some templating system jinja2, for which you can of course populate the variable to be substituted from your YAML file with common stages as well.
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
add a comment |
This is almost certainly a limitation of the includes (which would have been much better implemented explicitly with a tag).
Standard YAML loading consists of a parse, a compose and a construction phase. The aliases get resolved during the compose phase, and anchors e.g. do not carry over to the next document in multi-document YAML file.
Althoug the include
key might be interpreted as early the construction phase (but that might also happen after completing that phase, interpreting the resulting data structure), then the alias in the including YAML will already need to have been resolved during its compose phase.
You will have more luck using some templating system jinja2, for which you can of course populate the variable to be substituted from your YAML file with common stages as well.
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
add a comment |
This is almost certainly a limitation of the includes (which would have been much better implemented explicitly with a tag).
Standard YAML loading consists of a parse, a compose and a construction phase. The aliases get resolved during the compose phase, and anchors e.g. do not carry over to the next document in multi-document YAML file.
Althoug the include
key might be interpreted as early the construction phase (but that might also happen after completing that phase, interpreting the resulting data structure), then the alias in the including YAML will already need to have been resolved during its compose phase.
You will have more luck using some templating system jinja2, for which you can of course populate the variable to be substituted from your YAML file with common stages as well.
This is almost certainly a limitation of the includes (which would have been much better implemented explicitly with a tag).
Standard YAML loading consists of a parse, a compose and a construction phase. The aliases get resolved during the compose phase, and anchors e.g. do not carry over to the next document in multi-document YAML file.
Althoug the include
key might be interpreted as early the construction phase (but that might also happen after completing that phase, interpreting the resulting data structure), then the alias in the including YAML will already need to have been resolved during its compose phase.
You will have more luck using some templating system jinja2, for which you can of course populate the variable to be substituted from your YAML file with common stages as well.
answered Mar 22 at 18:21
AnthonAnthon
32.8k1798152
32.8k1798152
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
add a comment |
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
are you suggesting I can use jinja2 templating within the .gitlab-ci.yml file? Or that I should create that file using jinja2 templating via a script somehow? If the latter, can gitlab do this automagically via commit triggers or something? If so, pointers to docs explaining this would be most welcome! Thanks for your reply, btw, much appreciated!
– pll
Mar 23 at 21:55
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
I have no idea whether that can be done within gitlab. I have done something similar to docker-compose (providing unavailable functionality) by implementing a new command which generates the YAML file docker-compose expects and then calls docker-compose. And to support a YAML based documentation file format on readthedocs.org by running a pre-processor on the docs, on their backend. The latter is possible because they allow python code to run in a sandbox, gitlab would need to provide something similar, but I don't know if it does.
– Anthon
Mar 23 at 22:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304806%2fgitlab-and-placing-hidden-key-scripts-into-include-files%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown