Hot answers tagged

8

No, you can't have multiple gitlab-ci files per repository. You can see more information in the following links : https://gitlab.com/gitlab-org/gitlab-foss/issues/18157 https://gitlab.com/gitlab-org/gitlab-foss/issues/28592 Now, there are some work in progress about this, but it's not available yet. For example, you can see here ( https://gitlab.com/...


6

As suggested by @030, I have prepared two screenshots that show how to connect the .yml files with the build pipeline. Rename the .yml file in the repository Open the pipeline editor Select the file from the dropdown Select the in step 1 renamed *.yml file and click on save. After the existing .yml is assigned, the pipeline works as before the renaming.


5

According to this Azure Q&A it should be possible to change the name of the yaml file by clicking on "Edit in the visual designer".


4

Running your config.yml through yamllint, produced the following: 1:1 warning missing document start "---" (document-start) 13:3 error duplication of key "build" in mapping (key-duplicates) 25:19 error syntax error: mapping values are not allowed here When I add colons to the entry on lines 25 and 28: workflows: version: 2 ...


4

You simply have an incorrect yaml syntax in your workflows jobs list. From what I could very quickly understand on circleCI's documentation, jobs names are accepted as a shorthand if you don't define any parameters. If you have parameters, the list element is a hashmap with top element being the job name. In your specific case, this should give (note the ...


4

The issue seems resolved, If I escape the backslash in the regex too: - name: Remove LE webroot definition lineinfile: path: "/etc/path/to/config/{{ inventory_hostname }}.conf" regexp: "^{{ inventory_hostname | replace('.', '\\.') }} = /path/to/a/directory" state: absent


4

The keyword hosts is missing. Also colons : are needed after the hostnames. Fix the syntax, for example all: children: control: hosts: moriarty.server.com: toby.server.com: managed: hosts: sherlock.server.com: See How to build your inventory.


4

This has been fixed in recent version of Azure DevOps. Currently you can easily rename or move the pipeline in the list of pipelines while clicking on 3 dots and select Rename/move and change your location or move the pipeline


3

I'd suggest that you first put some default values within the playbook (if you explicitly want your variables there, for the purpose of .. reducing interactivity/command line args lets say): - hosts: all vars: user: greatuser passa: greatpassword Second, I'm pretty sure that pass is a reserved word somewhere, although I'm failing to find it in ...


3

Surprisingly indeed GitLab works weirdly with the env vars. It evaluates them internally, though it shouldn't in my view. Value set as (in project Settings > CI/CD > Variables): 'aaa$bbb*%' becomes 'aaa*%' (with single quotes left!) Couple of of proof links: https://gitlab.com/gitlab-org/gitlab-ce/issues/45173#note_101659865 https://gitlab.com/gitlab-org/...


3

Generally, Ansible is very flexible and often there are more "correct" solutions. Start for example with the question "Where do the configuration data come from?", put the default data to the roles and decide which variables should be configured in "group_vars/host_vars", in the roles, and which in the playbooks. Review Variable precedence: Where should I ...


3

According to the yamllint documentation you need to add a special comment to the line -- <string-to-be-excluded> # yamllint disable-line rule:line-length --- #defaults/main firefox_checksum: sha512:49d776cfb5f42c6e5ea1a55a80d9f6bad223080b16baa0d39de63534c25e68340091b4e16be5355d565f81291cb94fb996f03ae7e3e4c7a28021b0a0929daf58 #yamllint disable-line ...


3

If you launch the statefulset with the following key set {"spec":{"template":{"spec":{"serviceAccountName":"myserviceaccount"}}}} you can run curl \ https://kubernetes/apis/apps/v1/namespaces/<NAMESPACE>/statefulsets/<STATEFULSET> \ -k -H "Authorization: Bearer $(cat /var/run/secrets/...


3

I highly recommend using npm ci instead of npm install. The slow part of installing npm modules is figuring out everything that needs to be installed. If you commit your package-lock.json and use npm ci, it skips that part entirely and just looks at your lockfile to download what's needed. It's significantly faster.


3

YAML anchors are supported, but only for the same YAML file. You can't create the anchor (&) on a deployment file and reference (*) the value on another one. If you want to share ENVs values across multiple Deployments, you can create a ConfigMap with the ENVs and use the envFrom spec. Example: apiVersion: v1 kind: ConfigMap metadata: name: my-...


3

No, you cannot nest jinja2 expansion i.e. the following won't work: # Warning ! Those will fail ! some_var: "{{ some_dict[{{ some_dynamic_key }}] }}" other_var: "{{ {{ dynamicaly_prefixed }}_var }}" # Did I forget to say the above examples will fail ? But you can use your var without any problem, just as in almost any other programming ...


3

You can do: variables: templates.ref: $[ resources.repositories['templates'].ref ] See Repository Details docs.


2

I have found the answer to my own question after some more investigation. The reason the state was skipping the contents of my if statement was because the hostname of the server was in lower-case (god knows why). Therefore the in-built salt grains.item host which is called upon didn't recognise the server I was specifying.


2

You can have more than if statement per state. The issue is that your conditional doesn't seem actually be checking the hostname, it's just passing everything. Try this: {% if grains['host'] in ['dev-server2', 'test-server2'] %}


2

This slide share gives an idea how to handle CasC in Bamboo. The presenter advocates to use yaml, but according to him there are also downsides.


2

There is only one YAML spec. That would lead me to say "There are no YAML dialects". There are certainly differences in implementation, perhaps due to what the article claims as the spec's ambiguity: YAML specification is so ambiguous, It's a matter of opinion, I believe, but there is no doubting that various language-specific parsers of the same data ...


2

Assuming that deploy to DEV and QA steps look a lot like your deploy to production-staging environments, put the code that does that work into a yaml template and take advantage of parameters to allow you to pass in differing environment settings for DEV, QA, and Staging-Production. Then in one pipeline create a stage for each environment. The stage ...


2

This can be done by judicious use of one of the Ansible callback plugins. Set the relevant configuration in your ansible.cfg file. You have a few options... In order to print nothing to the screen, you can use the null callback: This callback prevents outputing events to screen However, this may be overkill and doesn't do what you want, which is to ...


2

Using docker-compose version 3.3 extensions and with the long variants for ports & volumes: version: '3.3' services: s1: &s build: . ports: - published: 5001 target: 9000 volumes: - source: ../www1 target: /var/www s2: <<: *s ports: - published: 5002 volumes: - source: ../www2 s3: &...


2

Not in pure Docker Compose. If you have a plain-text templating engine you like (Mustache, Jinja, m4, ...) you can ask it to do this for you. You tagged this as shell-script, and Compose can take the YAML configuration on stdin, so in principle one option is to write a shell script, and then pipe that into docker-compose: #!/bin/sh buildComposeYaml() { ...


2

Define the number of replicas in the values.yaml and pass it anywhere in resources (statefulset) Update 1: You can neither have a dynamic environment variable nor refer to the replicas field in STS. So the only way to get an updated count of STS in each pod is to redeploy with the new value of replicas in values.yaml: replicas: 3 Update 2: According to this ...


2

Maybe solving space problem first. Then, in my opinion, I prefer using rsync for copy file to server.


2

This error is due to invalid value of ansible_network_os: The playbook you try setup is meant for network devices. And since centos is not a network device OS the playbook will fail. Here you can find supported network OS. Ansible Documentation: ansible_network_os values If you don't have any device running a supported network OS I recommend you to follow ...


2

The answer is in the warning you get: [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' When you use hosts: all in your playbook, localhost is not matched. If you want to run the playbook on localhost, you can do one of the following: Change your playbook to hosts: localhost. ...


1

I commited the fix to the Github repo. The problem was that a role was included recursively. I split up the roles a bit to fix it. Also discovered a lot of other issues with repeated task executions (not all of the fixed yet because I'm still learning how to structure my ansible tasks)


Only top voted, non community-wiki answers of a minimum length are eligible