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;








0















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 ?










share|improve this question






























    0















    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 ?










    share|improve this question


























      0












      0








      0








      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 ?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 18:08









      Anthon

      32.8k1798152




      32.8k1798152










      asked Mar 22 at 17:21









      pllpll

      1612




      1612






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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.






          share|improve this answer























          • 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











          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
          );



          );













          draft saved

          draft discarded


















          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









          0














          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.






          share|improve this answer























          • 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















          0














          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.






          share|improve this answer























          • 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













          0












          0








          0







          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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

















          • 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



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript