GitXplorerGitXplorer
m

gl-env

public
0 stars
0 forks
1 issues

Commits

List of commits on branch main.
Verified
f05b76fb7988db658bd6a2ef330c66ab6786f853

Merge pull request #3 from mhutter/renovate/thiserror-2.x

mmhutter committed 2 months ago
Verified
de9afd4d687eb8c50f59f24dc5ccb198e27b71c8

fix(deps): update rust crate thiserror to v2

rrenovate[bot] committed 2 months ago
Verified
499d0b2d548501ffb506c525f943a25982f8eaf9

refactor: get rid of lib.rs

mmhutter committed 4 months ago
Verified
f6242f05a91a895735fa249fc67cc183b0f96b9f

refactor: Apply clippy suggestions

mmhutter committed 4 months ago
Verified
8415254c59f1e4ea981e2ca69082a2cd888a0ef7

fix: Allow -p/-g in any position

mmhutter committed 4 months ago
Verified
56edbe9d500dd965105552de6faec9171cbdf926

Merge pull request #1 from mhutter/renovate/configure

mmhutter committed 4 months ago

README

The README file for this repository.

gl-env

Bulk-edit Group- and Project-level CI/CD variables in GitLab.

This tools allows you to define your desired variables in a YAML file, and then diff or apply them automatically.

Features

  • List variables
  • Dump existing variables to YAML
  • Diff between desired and current values
  • Apply variables from local file
  • Support for different environment scopes

Installation

cargo install gl-env

(OS packages & GitHub releases soon?)

Usage

Start off by dumping existing variables into a YAML-File

gl-env dump -p mygroup/myproject > myproject.yml

Alternatively, create a file from scratch:

# Default configuration to apply to all variables.
#
# The same attributes can be applied to individual variables.
defaults:
  # Whether to mask the value in job logs.
  # NOTE: masked variable values must
  # - be a single line with no spaces
  # - be at least 8 characters long
  # - not match the name of an existing or predefined CI/CD variable
  # - not include special characters other than `@`, `_`, `-`, `:`, `+`
  # Default: `false`
  masked: false
  # Export variable to pipelines running on protected branches and tags only.
  # Default: `false`
  protected: false
  # Don't expand references to other variables.
  # `$` will be treated as the start of a reference to another variable.
  # Default: `false`
  raw: false

# Variables valid for ALL environments (`*`)
variables:
  KEY:
    value: The value!
    raw: true
  ANOTHER:
    value: some-val

# Variables only valid for specific environments
environment:
  test:
    MYSERVICE_KEY:
      value: test-environment-api-key
  prod:
    MYSERVICE_KEY:
      value: production-environment-api-key

You can then use the diff and apply subcommands:

gl-env diff -p mygroup/myproject < myproject.yml

# edit myproject.yml

gl-env apply -p mygroup/myproject < myproject.yml

See gl-env help to get complete usage information.

Backlog

  • [x] Support group-level variables or instance-level variables
  • [ ] Non-ugly error messages
  • [ ] String-or-struct for variables (?)
  • [x] Remove obsolete variables
  • [x] Default settings for all variables
  • [x] diff
  • [x] apply
  • [x] Support identically-named variables in different environments
  • [x] Ensure output order of variables is stable
  • [x] apply: List variables that are defined in GitLab but not locally

License

Licensed under the MIT license.