13

I've had two runs at doing environment variables in a scalable way and neither has ended up perfect because, as I've discovered, is a very tricky thing to get right. I'll give a summary of both of my experiences below: Common Factors Environment variables are stored in a separate repository from the original source code (they are submoduled together but ...


5

Yes. Just use ./ for you current directory that the Docker-compose file is in. Docker-Compose does not allow you to use a context that is located above the compose file, so everything the compose file will use is below the folder with the .yml. Your "working directory" for the compose file is just "./". If you are trying to set a directory below that it ...


4

General Notes I don't really understand this one: However, this seems clunky, as I have to create the logic to read this file in every script that is made. You can source all variables from a bash file in one line (source file-name.sh). If they are "exported", you can pick them up in applications in any language you like (Java, python, or whatever), ...


4

I'm not entirely sure what you're trying to ask in your question, so I'm answering the question I believe you're trying to ask. A build does not necessarily have a single commit author. It has a list of committers, which can be empty or can contain many committers. To create this list, you can use this snippet in a scripted Pipeline (note that you may ...


3

If your environments are per customer, I would suggest in your specific case to have a repository per customer. (In general it is repository per environment.) This repository would have a standard directory structure for environment variables, ansible variables and inventories, strongly encrypted secrets (account access tokens, private keys, etc.). You ...


3

The reason; having a more a version-agnostic and more backward-compatible directive in my server-environment-establishment script, to change the values of these two variables. If you're trying to configure a server, you should use a configuration management system (Ansible, Puppet, Chef, Salt) or bake images for immutable infrastructure; trying to hack ...


3

It is possible via network name: networks: mynetwork: name: ${STAGE_NAME} where mynetwork - name "inside" stack ${STAGE_NAME} -name for other stacks/services/containers See comment from docker capitan https://github.com/moby/moby/issues/40819#issuecomment-618726892


3

If you have envsubst installed (part or gnu gettext) you can use something like that: export STAGE_NAME="xyz" export STAGE_NETWORK_PREFIX="1.2.3.4" docker-compose -f <(envsubst docker-compose.yml) ... If your shell does not support process substitution, something like that would do the trick: envsubst docker-compose.yml | docker-compose -f - ...


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

PS C:\Users\gaius> Write-Output $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 1 17763 592 PS C:\Users\gaius> Write-Output $pwd Path ---- C:\Users\gaius That appears to work as expected, what versions of things are you using? Compare to Linux: gaius@klossy:~$ pwsh ...


1

The issue is that you can't reference the changed value in the same task. I created a new Powershell task and just called Write-Host "env:IP environment variable set to ($env:IP)" which output the IP address correctly.


1

According to your screen dump you have your port 80 mapped to the Traefik container 58cd5b59579c traefik:v2.2 "/entrypoint.sh --lo…" 16 minutes ago Up 15 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp frappe_docker_traefik_1 The listen address of this mapping is 0.0.0.0 on both port 80 HTTP, and 443 ...


1

The issue was missing comma between build job and parameters. Below is the correct syntax: ... build job: 'run-on-single-repo', parameters: ...


1

I think my case may be related as I also tried to configure environment for both Windows and Linux. I only have to mention that I am using docker-compose on WSL1 (Windows Subsystem for Linux) configured following by: this I suggest you to try My solution is (using the: long-syntax volumes definition from official docs): version: '3.7' services: web: ...


1

I'm not familiar with teamcity, but you can : add a config folder in your repo, and inside this repo create three files (staging.yml, preprod.yml, prod.yml). on each file you will write down variables specific to each environment, and apply them within pipeline. For secrets, it's cautious to handle that manually or better use Vault. To not throw on error ...


1

This is not answering only the question but also a bit more (I put this here for reference): I found out a decent way to tackle this and some complications coming afterwards... (after hours and hours of fiddling) - e.g. to execute the script in an SSH session: deploy job: variables: # the variables could come from anywhere (e.g. GitLab Settings - ...


1

Your string isn't being interpolated at the correct time because it's in single quotes. Instead it's being passed to the checkout method as an un-interpolated string. By the time the checkout method interpolates the string, the perf variable is out of scope and so interpretation of this variable falls back to a blank string. Something like this is what ...


1

My understanding of the variable groups is that you would create this to leverage the same variables across multiple pipelines. If you needed to update the value, you'd only have to update it on the library instead of updating it on dozens of pipelines. If you are only going to use the variable group on a single pipeline definition, variables groups appear ...


1

try this one static void main(String[] args) { // Initializing 2 variables def x = 5; def y = 10; //Performing addition of 2 operands println(x+y); } } check this URL


1

I recommend that you use the printenv command for list system Variable: printenv and also An easy way to obtain the Jenkins environment variables list from your local installation is to append env-vars.html to the server's URL. the URL would be http://{jenkins_url}/env-vars.html


1

PHP has supported conf.d configuration subdirectories for ages now (cf. PHP_INI_SCAN_DIR in its documentation, this stuff is as old as PHP 5 basically) - allowing you to simply add a small file containing just the snippet of config you need in there, and as long as you make sure it's named so that it's ordered in a way it overrides the defaults, you're done. ...


1

check out https://direnv.net/ it sets environment variables based on the directory you are in. other options are: 1.docker-compose 2.plain bash to set the variables. 3. bash source .env 4. use prefixes but you would still need to set the environment you are in via an environment variable, so back to options 1-3. if you are going to store passwords or keys ...


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