From 03f946f2994d6e768669ed306c35059251d756be Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Dec 2023 10:21:08 -0800 Subject: [PATCH 1/7] Create action.yml Signed-off-by: John Andersen --- action.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 00000000..f544337f --- /dev/null +++ b/action.yml @@ -0,0 +1,45 @@ +name: 'scitt-client' +description: 'Create and submit statement to a SCITT instance' +inputs: + issuer: + description: 'Issuer of statement' + required: true + subject: + description: 'Subject of statement' + required: true + payload: + description: 'Payload for statement' + required: true + payload-content-type: + description: 'Statement payload content-type' + required: false + default: 'application/json' + private-key-pem: + description: 'Private key pem bytes' + required: true + scitt-url: + description: 'URL of scitt instance' + required: true +outputs: + entry-id: + description: "Entry ID of submitted statement" + value: ${{ steps.submit-statement.outputs.entry-id }} +runs: + using: "composite" + steps: + - name: Create statement + shell: bash + env: + ISSUER: ${{ inputs.issuer }} + PAYLOAD: ${{ inputs.payload }} + PAYLOAD_CONTENT_TYPE: ${{ inputs.payload-content-type }} + run: | + # TODO --subject "${SUBJECT}" + scitt-emulator client create-claim --issuer "${ISSUER}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor + - name: Submit statement + id: submit-statement + env: + SCITT_URL: ${{ inputs.scitt-url }} + run: | + scitt-emulator client submit-claim --url "${SCITT_URL}" --claim statement.cbor --out statement.receipt.cbor 2>&1 | tee >(grep Entry\ ID: | awk '{print $NF}' > entry_id.txt) + echo "entry-id=$(cat entry_id.txt)" >> "${GITHUB_OUTPUT}" From 5e4271fd768410636b706000087ba12a3ac7db6c Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Dec 2023 10:44:12 -0800 Subject: [PATCH 2/7] Update action.yml Signed-off-by: John Andersen --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index f544337f..ecdd1f85 100644 --- a/action.yml +++ b/action.yml @@ -37,6 +37,7 @@ runs: # TODO --subject "${SUBJECT}" scitt-emulator client create-claim --issuer "${ISSUER}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor - name: Submit statement + shell: bash id: submit-statement env: SCITT_URL: ${{ inputs.scitt-url }} From 2d49e7dfc468ef7ba70490b37689fbffd1189441 Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Dec 2023 10:50:03 -0800 Subject: [PATCH 3/7] Update action.yml Signed-off-by: John Andersen --- action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/action.yml b/action.yml index ecdd1f85..28920f1f 100644 --- a/action.yml +++ b/action.yml @@ -34,8 +34,7 @@ runs: PAYLOAD: ${{ inputs.payload }} PAYLOAD_CONTENT_TYPE: ${{ inputs.payload-content-type }} run: | - # TODO --subject "${SUBJECT}" - scitt-emulator client create-claim --issuer "${ISSUER}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor + scitt-emulator client create-claim --issuer "${ISSUER}" --subject "${SUBJECT}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor - name: Submit statement shell: bash id: submit-statement From 64e7f6657acdaaae4f2105b3005ebe05437c8a8d Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Dec 2023 11:13:30 -0800 Subject: [PATCH 4/7] Update action.yml Signed-off-by: John Andersen --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 28920f1f..9b146c56 100644 --- a/action.yml +++ b/action.yml @@ -32,9 +32,10 @@ runs: env: ISSUER: ${{ inputs.issuer }} PAYLOAD: ${{ inputs.payload }} + PRIVATE_KEY_PEM: ${{ inputs.private-key-pem }} PAYLOAD_CONTENT_TYPE: ${{ inputs.payload-content-type }} run: | - scitt-emulator client create-claim --issuer "${ISSUER}" --subject "${SUBJECT}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor + scitt-emulator client create-claim --issuer "${ISSUER}" --subject "${SUBJECT}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor --private-key-pem "${PRIVATE_KEY_PEM}" - name: Submit statement shell: bash id: submit-statement From 5571a6f1122137304d5563e53befbabc00111538 Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Dec 2023 11:14:11 -0800 Subject: [PATCH 5/7] Update action.yml Signed-off-by: John Andersen --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 9b146c56..6ae2e846 100644 --- a/action.yml +++ b/action.yml @@ -28,7 +28,7 @@ runs: using: "composite" steps: - name: Create statement - shell: bash + shell: bash -xeuo pipefail {0} env: ISSUER: ${{ inputs.issuer }} PAYLOAD: ${{ inputs.payload }} @@ -37,7 +37,7 @@ runs: run: | scitt-emulator client create-claim --issuer "${ISSUER}" --subject "${SUBJECT}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor --private-key-pem "${PRIVATE_KEY_PEM}" - name: Submit statement - shell: bash + shell: bash -xeuo pipefail {0} id: submit-statement env: SCITT_URL: ${{ inputs.scitt-url }} From f1f5c16630a28511e970b6903fbc4c0db6c07654 Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Dec 2023 11:15:34 -0800 Subject: [PATCH 6/7] Update action.yml Signed-off-by: John Andersen --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 6ae2e846..941485b3 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,7 @@ runs: env: ISSUER: ${{ inputs.issuer }} PAYLOAD: ${{ inputs.payload }} + SUBJECT: ${{ inputs.subject }} PRIVATE_KEY_PEM: ${{ inputs.private-key-pem }} PAYLOAD_CONTENT_TYPE: ${{ inputs.payload-content-type }} run: | From b1cfd2b55b87b5e1be936c717682a9930c536db1 Mon Sep 17 00:00:00 2001 From: John Andersen Date: Mon, 8 Apr 2024 13:06:06 -0700 Subject: [PATCH 7/7] Update action.yml Signed-off-by: John Andersen --- action.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 941485b3..ca44f420 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: scitt-url: description: 'URL of scitt instance' required: true + scitt-pip-install: + description: 'Argument to pass to pip to install scitt-emulator Python package (defaults to main.tar.gz of upstream repo)' + default: 'https://github.com/scitt-community/scitt-api-emulator/archive/refs/heads/main.tar.gz' outputs: entry-id: description: "Entry ID of submitted statement" @@ -27,6 +30,19 @@ outputs: runs: using: "composite" steps: + - uses: actions/setup-python@v5 + id: setup-python + with: + python-version: '3.12' + update-environment: false + - name: "Install Dependencies" + shell: bash -xeuo pipefail {0} + env: + SCITT_PIP_INSTALL: ${{ inputs.scitt-pip-install }} + run: | + export LD_LIBRARY_PATH="$(dirname $(dirname ${{ steps.setup-python.outputs.python-path }}))/lib:${LD_LIBRARY_PATH}" + echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV + ${{ steps.setup-python.outputs.python-path }} -m pip install "${SCITT_PIP_INSTALL}" - name: Create statement shell: bash -xeuo pipefail {0} env: @@ -36,12 +52,12 @@ runs: PRIVATE_KEY_PEM: ${{ inputs.private-key-pem }} PAYLOAD_CONTENT_TYPE: ${{ inputs.payload-content-type }} run: | - scitt-emulator client create-claim --issuer "${ISSUER}" --subject "${SUBJECT}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor --private-key-pem "${PRIVATE_KEY_PEM}" + "$(dirname ${{ steps.setup-python.outputs.python-path }})/scitt-emulator" client create-claim --issuer "${ISSUER}" --subject "${SUBJECT}" --content-type "${PAYLOAD_CONTENT_TYPE}" --payload "${PAYLOAD}" --out statement.cbor --private-key-pem "${PRIVATE_KEY_PEM}" - name: Submit statement shell: bash -xeuo pipefail {0} id: submit-statement env: SCITT_URL: ${{ inputs.scitt-url }} run: | - scitt-emulator client submit-claim --url "${SCITT_URL}" --claim statement.cbor --out statement.receipt.cbor 2>&1 | tee >(grep Entry\ ID: | awk '{print $NF}' > entry_id.txt) + "$(dirname ${{ steps.setup-python.outputs.python-path }})/scitt-emulator" client submit-claim --url "${SCITT_URL}" --claim statement.cbor --out statement.receipt.cbor 2>&1 | tee >(grep Entry\ ID: | awk '{print $NF}' > entry_id.txt) echo "entry-id=$(cat entry_id.txt)" >> "${GITHUB_OUTPUT}"