Skip to content

Commit

Permalink
avoid interpolation in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
zivnevo committed Feb 7, 2022
1 parent 2984f76 commit 2e3bfeb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tekton/netpol-synthesis-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ spec:
- name: make-result-dir # This step prepares the output directory, as netpol-synth runs without root permissions.
image: ubuntu
workingDir: $(workspaces.source.path)
env:
- name: PARAMS_OUTPUT_DIR
value: $(params.output-dir)
script: |
#!/bin/sh
mkdir -p $(params.output-dir)
chmod a+w $(params.output-dir)
mkdir -p "$PARAMS_OUTPUT_DIR"
chmod a+w "$PARAMS_OUTPUT_DIR"
- name: analyze-repo
image: ghcr.io/np-guard/net-top-analyzer@sha256:bd40a99fdbd293040a66166abd978bb806e17bf991998ba83fe06bac77e63a06
workingDir: $(workspaces.source.path)
Expand All @@ -42,15 +45,18 @@ spec:
image: ghcr.io/np-guard/netpol-synth@sha256:148e371fb40fd24ea924c1c32c969481f27808171dd901dd60141bd9f2f87b76
workingDir: $(workspaces.source.path)
args: ["$(params.corporate-policies[*])"]
env:
- name: PARAMS_OUTPUT_DIR
value: $(params.output-dir)
script: |
#!/bin/sh
for policy in "$@"
do
POLICIES_WITH_B="-b $policy $POLICIES_WITH_B"
done
OUTFILE=$(params.output-dir)/netpols.yaml
OUTFILE="$PARAMS_OUTPUT_DIR/netpols.yaml"
python /netpol-synthesizer/src/netpol_synth.py $(params.output-dir)/app-net-top.json -o $OUTFILE ${POLICIES_WITH_B}
python /netpol-synthesizer/src/netpol_synth.py "$PARAMS_OUTPUT_DIR/app-net-top.json" -o "$OUTFILE" ${POLICIES_WITH_B}
printf '%s' "${OUTFILE}" | tee $(results.synth-netpol-file.path)

0 comments on commit 2e3bfeb

Please sign in to comment.