Skip to content

Commit

Permalink
use yq to parse yaml value
Browse files Browse the repository at this point in the history
  • Loading branch information
aaperis committed Dec 19, 2024
1 parent 2ed235f commit 0ede086
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sda-download/.github/integration/setup/common/20_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ C4GH_VERSION="$(curl --retry 100 -sL https://api.github.com/repos/neicnordic/cry
curl --retry 100 -sL https://github.com/neicnordic/crypt4gh/releases/download/"${C4GH_VERSION}"/crypt4gh_linux_x86_64.tar.gz | sudo tar -xz -C /usr/bin/ &&
sudo chmod +x /usr/bin/crypt4gh

sudo apt install -y jq s3cmd
sudo apt install -y jq s3cmd yq
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ echo "expected file found"
# Test file can be decrypted
## test also the files endpoint

C4GH_PASSPHRASE=$(grep -F passphrase config.yaml | tail -1 | sed -e 's/.* //' -e 's/"//g')
C4GH_PASSPHRASE=$(yq '.c4gh.passphrase' config.yaml)
export C4GH_PASSPHRASE

crypt4gh decrypt -s c4gh.sec.pem -f dummy_data.c4gh && mv dummy_data old-file.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ token=$(curl -s --cacert certs/ca.pem "https://localhost:8000/tokens" | jq -r '
dataset="https://doi.example/ty009.sfrrss/600.45asasga"
file="dummy_data"
expected_size=1048605
C4GH_PASSPHRASE=$(grep -F passphrase config.yaml | tail -1 | sed -e 's/.* //' -e 's/"//g')
C4GH_PASSPHRASE=$(yq '.c4gh.passphrase' config.yaml)
export C4GH_PASSPHRASE

# download decrypted full file, check file size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ echo "expected file found"
# Test file can be decrypted
## test also the files endpoint

C4GH_PASSPHRASE=$(grep -F passphrase config.yaml | tail -1 | sed -e 's/.* //' -e 's/"//g')
C4GH_PASSPHRASE=$(yq '.c4gh.passphrase' config.yaml)
export C4GH_PASSPHRASE

crypt4gh decrypt -s c4gh.sec.pem -f dummy_data.c4gh && mv dummy_data old-file.txt
Expand Down
4 changes: 2 additions & 2 deletions sda-download/dev_utils/run_integration_test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

for c in s3cmd jq
for c in s3cmd jq yq
do
if ! command -v $c
then
Expand Down Expand Up @@ -194,7 +194,7 @@ echo "expected file found"
# Test file can be decrypted
## test also the files endpoint

C4GH_PASSPHRASE=$(grep -F passphrase config.yaml | tail -1 | sed -e 's/.* //' -e 's/"//g')
C4GH_PASSPHRASE=$(yq '.c4gh.passphrase' config.yaml)
export C4GH_PASSPHRASE

crypt4gh decrypt --sk c4gh.sec.pem < dummy_data.c4gh > old-file.txt
Expand Down
4 changes: 2 additions & 2 deletions sda-download/dev_utils/run_integration_test_no_tls.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

for c in s3cmd jq
for c in s3cmd jq yq
do
if ! command -v $c
then
Expand Down Expand Up @@ -152,7 +152,7 @@ echo "expected file found"
# Test file can be decrypted
## test also the files endpoint

C4GH_PASSPHRASE=$(grep -F passphrase config.yaml | tail -1 | sed -e 's/.* //' -e 's/"//g')
C4GH_PASSPHRASE=$(yq '.c4gh.passphrase' config.yaml)
export C4GH_PASSPHRASE

crypt4gh decrypt --sk c4gh.sec.pem < dummy_data.c4gh > old-file.txt
Expand Down

0 comments on commit 0ede086

Please sign in to comment.