Skip to content

Commit 66076ed

Browse files
authored
Merge pull request #461 from thunze/masked-and-hidden
Create GitLab CI/CD variables with visibility masked and hidden on init
2 parents e97e083 + 54e90ce commit 66076ed

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/hermes/commands/init/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,13 +599,13 @@ def configure_gitlab(self) -> None:
599599
self.git_remote_url + "/-/settings/ci_cd", "project's ci settings")
600600
))
601601
sc.echo("Then, add that token as variable with key HERMES_PUSH_TOKEN.")
602-
sc.echo("(For your safety, you should set the visibility to 'Masked'.)")
602+
sc.echo("(For your safety, you should set the visibility to 'Masked and hidden'.)")
603603
sc.press_enter_to_continue()
604604
sc.echo("Next, add the {} token{} as variable with key ZENODO_TOKEN.".format(
605605
self.deposit_platform.name,
606606
f" ({self.tokens[self.deposit_platform]})" if self.tokens[self.deposit_platform] else ""
607607
))
608-
sc.echo("(For your safety, you should set the visibility to 'Masked'.)")
608+
sc.echo("(For your safety, you should set the visibility to 'Masked and hidden'.)")
609609
sc.press_enter_to_continue()
610610

611611
def choose_deposit_platform(self) -> None:

src/hermes/commands/init/util/connect_gitlab.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,14 @@ def create_variable(self, key: str, value, description: str = "") -> bool:
120120
sc.debug_info(delete_status=delete_response.status_code, delete_response=delete_response.text)
121121
# Then create a new variable
122122
create_url = urljoin(self.api_url, f"projects/{self.project_id}/variables")
123-
data = {"key": key, "value": value, "masked": True, "raw": True, "description": description}
123+
data = {
124+
"key": key,
125+
"value": value,
126+
"masked": True,
127+
"masked_and_hidden": True,
128+
"raw": True,
129+
"description": description,
130+
}
124131
response = requests.post(create_url, headers=headers, json=data)
125132
if response.status_code == 201:
126133
desc = f" ({description})" if description else ""

0 commit comments

Comments
 (0)