Skip to content

Commit

Permalink
feat(trustengine): Pass Trust Engine token to container (#216)
Browse files Browse the repository at this point in the history
* passing orhestrator jwt to piper docker env

* removing adding or orhestrator jwt as a parameter

* including the orchestrator jwt in dist

* including orchestrator jwt and runner jwt to the docker container

* updating npm build

* passing only trust engine token to container

* update trust engine env var name

* update unit tests

---------

Co-authored-by: jliempt <>
  • Loading branch information
anilkeshav27 authored Sep 16, 2024
1 parent 2cb610d commit 09379a0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
11 changes: 9 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export async function startContainer (actionCfg: ActionConfiguration, ctxConfig:
...getProxyEnvVars(),
...getOrchestratorEnvVars(),
...getVaultEnvVars(),
...getTrustEngineJWT(),
dockerImage,
'cat'
)
Expand Down Expand Up @@ -149,6 +150,13 @@ export function getProxyEnvVars (): string[] {
]
}

export function getTrustEngineJWT (): string[] {
return [
'--env',
'PIPER_trustEngineToken'
]
}

export async function dockerExecReadOutput (dockerRunArgs: string[]): Promise<string> {
let dockerOutput = ''
const options = {
Expand Down
5 changes: 5 additions & 0 deletions test/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getOrchestratorEnvVars,
getProxyEnvVars,
getVaultEnvVars,
getTrustEngineJWT,
runContainers,
startContainer,
stopContainer
Expand Down Expand Up @@ -103,6 +104,7 @@ describe('Docker', () => {
...getProxyEnvVars(),
...getOrchestratorEnvVars(),
...getVaultEnvVars(),
...getTrustEngineJWT(),
actionConfig.dockerImage,
'cat'
]
Expand Down Expand Up @@ -131,6 +133,7 @@ describe('Docker', () => {
...getProxyEnvVars(),
...getOrchestratorEnvVars(),
...getVaultEnvVars(),
...getTrustEngineJWT(),
actionConfig.dockerImage,
'cat'
]
Expand Down Expand Up @@ -163,6 +166,7 @@ describe('Docker', () => {
...getProxyEnvVars(),
...getOrchestratorEnvVars(),
...getVaultEnvVars(),
...getTrustEngineJWT(),
ctxCfg.dockerImage,
'cat'
]
Expand Down Expand Up @@ -200,6 +204,7 @@ describe('Docker', () => {
...getProxyEnvVars(),
...getOrchestratorEnvVars(),
...getVaultEnvVars(),
...getTrustEngineJWT(),
ctxCfg.dockerImage,
'cat'
]
Expand Down

0 comments on commit 09379a0

Please sign in to comment.