Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fetch secrets from vault #61

Open
chetan-dua opened this issue May 18, 2023 · 1 comment
Open

Unable to fetch secrets from vault #61

chetan-dua opened this issue May 18, 2023 · 1 comment

Comments

@chetan-dua
Copy link

chetan-dua commented May 18, 2023

Server Version: TeamCity Professional 2022.10.3 (build 117072)
jetbrains/teamcity-server:2022.10.3 (docker image ID: c0edf4d5ae59)

Vault plugin version: 0.1.119
Agent: jetbrains/teamcity-agent (docker image ID: 45f54a688267)

Documentation referred:

  1. https://blog.jetbrains.com/teamcity/2017/09/vault/
  2. https://plugins.jetbrains.com/plugin/10011-hashicorp-vault-support

Steps to reproduce:

  1. Create a project
  2. Goto connections -> Add Connection -> Use Vault AppRole - > (Fill necessary parameters) -> Test Connection (Shows Success)
  3. Create build configuration (name=vault_test) -> Add new parameter (do not mask) -> Name: env.SECRET , Value: %vault:devops/data/api-keys!/devops-na!/secret%
  4. build step -> command-line
#!/bin/bash
echo SECRET=${SECRET}

Expected Output
SECRET="ActualSecrethere"

Actual Output:
SECRET=%vault:devops/data/api-keys!/devops-na!/secret%

This is same as variable value itself.

Other options tried:

  1. Name: env.VAULT_SUPPORTED Value: %teamcity.vault.supported% , Output = true
  2. Name: env.SECRET , Value: %vault:/devops/data/api-keys!/devops-na!/secret% (see / at starting of path), Output = Same as Value string but not actual secret
  3. Name: env.URL , Value: %teamcity.vault.url% , Output: (as visible in configuration parameters section)

Build Log:

[07:50:57] :	 [Step 1/1] Starting: /opt/buildagent/temp/agentTmp/custom_script4451755130190608596 
[07:50:57] :	 [Step 1/1] in directory: /opt/buildagent/work/2b35ac7e0452d98f
[07:50:57] :	 [Step 1/1] VAULT_SUPPORTED=true
[07:50:57] :	 [Step 1/1] SECRET=%vault:devops/data/api-keys!/devops-na!/secret%
[07:50:57] :	 [Step 1/1] AWS_SECRET=%vault:aws/data/creds/developer!/access_key%
[07:50:57] :	 [Step 1/1] Process exited with code 0
[07:50:57] : Publishing internal artifacts

I have read other reported issues in this repo already and the options haven't helped much.

Note that using vault utility on bash works fine though.

@VladRassokhin
Copy link
Contributor

Try %vault:devops/data/api-keys!/devops-na/secret%, note that there's only one !/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants