Skip to content

feat(set): add raw flag for set variable command

Mat Gautron requested to merge Mat.G/cli:adding-raw-flag-create-variable into main

Description

This adds an optional flag for gitlab to treat the variable as raw.

This is already set in the Gitlab API, and the go-gitlab library. This just adds the flag to Cobra to be passed on.

notes for reviewer:

I added some basic unit tests that check the flag is added correctly. Not very confident with their value or if I've set those up correctly.

I did not add integration tests. I'm not familiar with those or how they are used, but if you consider it a requirement for this change, please let me know where to get started there. Thanks.

Related Issues

Resolves #7246 (closed)

How has this been tested?

I ran a manual test.

./bin/glab variable set TEST_NOT_RAW "test_value_not_raw" and ./bin/glab variable set -r TEST_RAW "test_value_raw"

I then confirmed those variables were created as expected in the gitlab GUI (see screenshots)

Screenshots (if appropriate):

20231006_06h40m37s_grim 20231006_06h39m54s_grim 20231006_06h40m30s_grim

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Niklas van Schrick

Merge request reports