Loading .gitlab-ci.yml +1 −0 Changes for .gitlab-ci.yml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ stages: - gitlabci-local -c ./tests/configurations/.gitlab-ci.yml -e VARIABLE_8=value8 -e VARIABLE_11=value11 -p </dev/null - gitlabci-local -c ./tests/environment/.gitlab-ci.yml -p - gitlabci-local -c ./tests/environment/.gitlab-ci.yml -e USER -e VALUE_1=set1 -e VALUE_2=set2 -e VALUE_3=set3 -p - gitlabci-local -c ./tests/environment/.gitlab-ci.yml -e USER -e ./tests/environment/environment.txt -p 'Deploy Test': stage: deploy Loading README.md +6 −3 Changes for README.md: 6 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ gitlabci-runner-local: Launch .gitlab-ci.yml jobs locally | -b, --before | Enable before_script executions | | -a, --after | Enable after_script executions | | -m, --manual | Allow manual jobs to be used | | -e ENV | Define VARIABLE=value or pass VARIABLE environment | | -e ENV | Define VARIABLE=value, pass VARIABLE or ENV file | | -t TAGS | Handle listed tags as manual jobs<br>Default list: ['deploy', 'local', 'publish'] | | -p, --pipeline | Run complete stages rather than jobs | | -d, --dump | Dump parsed .gitlab-ci.yml configuration | Loading Loading @@ -83,8 +83,11 @@ gitlabci-local uses the variables defined in .gitlab-ci.yml, parses the simple environment variables file named `.env` and the configurations selected through `.configurations`. If specific environment variables are to be used in the job's container, the `-e VARIABLE` or `-e VARIABLE=value` parameters can be used. If specific environment variables are to be used in the job's container: - `-e VARIABLE`: pass an environment variable - `-e VARIABLE=value`: set a variable to a specific value - `-e ENVIRONMENT_FILE`: parse a file as default variables For example, `-e TERM=ansi` may enable colored terminal outputs. Loading gitlabci_local/main.py +1 −1 Changes for gitlabci_local/main.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ def main(): parser.add_argument('-p', '--pipeline', dest='pipeline', action='store_true', help='Run complete stages rather than jobs') parser.add_argument('-e', dest='env', action='append', help='Define VARIABLE=value or pass VARIABLE environment') help='Define VARIABLE=value, pass VARIABLE or ENV file') parser.add_argument( '-t', dest='tags', action='append', help='Handle listed tags as manual jobs\nDefault list: [\'%s\']' % Loading gitlabci_local/parser.py +24 −5 Changes for gitlabci_local/parser.py: 24 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -18,23 +18,27 @@ def reader(options): # Variables environment = { 'default': dict(), 'files': [], 'parameters': dict(), } # Parse environment files for environment_file in [Path(options.path) / '.env']: if environment_file.is_file(): environment['default'] = dotenv_values(dotenv_path=environment_file) # Parse environment options if options.env: for env in [env for env in options.env]: env_parsed = env.split('=', 1) # Parse VARIABLE=value if len(env_parsed) == 2: variable = env_parsed[0] value = env_parsed[1] os.environ[variable] = value environment['parameters'][variable] = value # Parse ENVIRONMENT_FILE elif os.path.isfile(env): environment['files'] += [Path(os.path.abspath(env))] # Parse VARIABLE else: variable = env if variable in os.environ: Loading @@ -42,6 +46,21 @@ def reader(options): else: environment['parameters'][variable] = '' # Iterate through environment files environment['files'] += [Path(options.path) / '.env'] for environment_file in environment['files']: if not environment_file.is_file(): continue # Parse environment files environment_file_values = dotenv_values(dotenv_path=environment_file) for variable in environment_file_values: # Defile default environment variable if variable in environment['default']: continue environment['default'][variable] = environment_file_values[variable] # Read GitLab CI YAML try: with open(options.configuration, 'r') as configuration_data: Loading tests/environment/environment.txt 0 → 100644 +4 −0 Changes for tests/environment/environment.txt: 4 added lines, 0 removed lines. Original line number Diff line number Diff line IMAGE_REFERENCE_1=alpine:3.11 IMAGE_REFERENCE_2=alpine:3 VALUE_1=override1 VALUE_2= No newline at end of file Loading
.gitlab-ci.yml +1 −0 Changes for .gitlab-ci.yml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ stages: - gitlabci-local -c ./tests/configurations/.gitlab-ci.yml -e VARIABLE_8=value8 -e VARIABLE_11=value11 -p </dev/null - gitlabci-local -c ./tests/environment/.gitlab-ci.yml -p - gitlabci-local -c ./tests/environment/.gitlab-ci.yml -e USER -e VALUE_1=set1 -e VALUE_2=set2 -e VALUE_3=set3 -p - gitlabci-local -c ./tests/environment/.gitlab-ci.yml -e USER -e ./tests/environment/environment.txt -p 'Deploy Test': stage: deploy Loading
README.md +6 −3 Changes for README.md: 6 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ gitlabci-runner-local: Launch .gitlab-ci.yml jobs locally | -b, --before | Enable before_script executions | | -a, --after | Enable after_script executions | | -m, --manual | Allow manual jobs to be used | | -e ENV | Define VARIABLE=value or pass VARIABLE environment | | -e ENV | Define VARIABLE=value, pass VARIABLE or ENV file | | -t TAGS | Handle listed tags as manual jobs<br>Default list: ['deploy', 'local', 'publish'] | | -p, --pipeline | Run complete stages rather than jobs | | -d, --dump | Dump parsed .gitlab-ci.yml configuration | Loading Loading @@ -83,8 +83,11 @@ gitlabci-local uses the variables defined in .gitlab-ci.yml, parses the simple environment variables file named `.env` and the configurations selected through `.configurations`. If specific environment variables are to be used in the job's container, the `-e VARIABLE` or `-e VARIABLE=value` parameters can be used. If specific environment variables are to be used in the job's container: - `-e VARIABLE`: pass an environment variable - `-e VARIABLE=value`: set a variable to a specific value - `-e ENVIRONMENT_FILE`: parse a file as default variables For example, `-e TERM=ansi` may enable colored terminal outputs. Loading
gitlabci_local/main.py +1 −1 Changes for gitlabci_local/main.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ def main(): parser.add_argument('-p', '--pipeline', dest='pipeline', action='store_true', help='Run complete stages rather than jobs') parser.add_argument('-e', dest='env', action='append', help='Define VARIABLE=value or pass VARIABLE environment') help='Define VARIABLE=value, pass VARIABLE or ENV file') parser.add_argument( '-t', dest='tags', action='append', help='Handle listed tags as manual jobs\nDefault list: [\'%s\']' % Loading
gitlabci_local/parser.py +24 −5 Changes for gitlabci_local/parser.py: 24 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -18,23 +18,27 @@ def reader(options): # Variables environment = { 'default': dict(), 'files': [], 'parameters': dict(), } # Parse environment files for environment_file in [Path(options.path) / '.env']: if environment_file.is_file(): environment['default'] = dotenv_values(dotenv_path=environment_file) # Parse environment options if options.env: for env in [env for env in options.env]: env_parsed = env.split('=', 1) # Parse VARIABLE=value if len(env_parsed) == 2: variable = env_parsed[0] value = env_parsed[1] os.environ[variable] = value environment['parameters'][variable] = value # Parse ENVIRONMENT_FILE elif os.path.isfile(env): environment['files'] += [Path(os.path.abspath(env))] # Parse VARIABLE else: variable = env if variable in os.environ: Loading @@ -42,6 +46,21 @@ def reader(options): else: environment['parameters'][variable] = '' # Iterate through environment files environment['files'] += [Path(options.path) / '.env'] for environment_file in environment['files']: if not environment_file.is_file(): continue # Parse environment files environment_file_values = dotenv_values(dotenv_path=environment_file) for variable in environment_file_values: # Defile default environment variable if variable in environment['default']: continue environment['default'][variable] = environment_file_values[variable] # Read GitLab CI YAML try: with open(options.configuration, 'r') as configuration_data: Loading
tests/environment/environment.txt 0 → 100644 +4 −0 Changes for tests/environment/environment.txt: 4 added lines, 0 removed lines. Original line number Diff line number Diff line IMAGE_REFERENCE_1=alpine:3.11 IMAGE_REFERENCE_2=alpine:3 VALUE_1=override1 VALUE_2= No newline at end of file