Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
#30 Bringing secrets inside podman
Browse files Browse the repository at this point in the history
  • Loading branch information
marcionemec-daitan committed Feb 13, 2024
1 parent b05a812 commit 471017f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile_Polaris
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def podman
pipeline {
agent none
environment {
vtoken = credentials('VToken')
vtoken = credentials('VTOKEN')
teste = '123'
}
stages {
Expand All @@ -29,7 +29,7 @@ pipeline {
sh 'dir'
sh 'echo $teste'
sh 'echo $vtoken'
sh 'podman build --build-arg=vtoken=\'$voken\' --build-arg=teste=\'$teste\' --file=Dockerfile_Polaris .'
sh 'podman build --build-arg=vtoken=\'$vtoken\' --build-arg=teste=\'$teste\' --file=Dockerfile_Polaris .'
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ def do_tests_in_jenkins():

def testVault():
teste = os.environ['teste'] # Copying my token from vault
print(teste)
if teste =='123'
print("OK"")
else:
print("not expected teste")
vault_token = os.environ['vtoken'] # Copying my token from vault
print(vault_token)
if vault_token.startswith('hvs.')
print("Vault Looks OK!")
else:
print("Vault Looks BAD!")

vault_url = 'https://knox.io.nrs.gov.bc.ca/v1/groups/data/spar/test'
headers = {'X-Vault-Token': vault_token}
res = requests.get(vault_url, headers=headers)
Expand Down

0 comments on commit 471017f

Please sign in to comment.