From 8d1c928e1d2bd55b4b4031ae36011ce840203618 Mon Sep 17 00:00:00 2001 From: Javier Rodriguez Date: Tue, 4 Jun 2024 14:13:46 +0200 Subject: [PATCH 1/2] feat(c8l): Update c8l to allow workflow-names on attestations Signed-off-by: Javier Rodriguez --- .github/workflows/chainloop.yml | 5 ++++- .github/workflows/chainloop_init.yml | 4 ++++ .github/workflows/chainloop_push.yml | 4 ++++ tools/c8l | 6 +++++- tools/src/lib/chainloop.sh | 6 +++++- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/chainloop.yml b/.github/workflows/chainloop.yml index 3d23726..6fc80f8 100644 --- a/.github/workflows/chainloop.yml +++ b/.github/workflows/chainloop.yml @@ -15,6 +15,9 @@ on: required: false type: string default: main + workflow_name: + required: false + type: string secrets: api_token: required: true @@ -102,4 +105,4 @@ jobs: CHAINLOOP_VERSION: ${{ inputs.chainloop_version }} CHAINLOOP_TOKEN: ${{ secrets.api_token }} CHAINLOOP_CONTRACT_REVISION: ${{ inputs.contract_revision }} - + CHAINLOOP_WORKFLOW_NAME: ${{ inputs.workflow_name }} diff --git a/.github/workflows/chainloop_init.yml b/.github/workflows/chainloop_init.yml index 165e778..242db42 100644 --- a/.github/workflows/chainloop_init.yml +++ b/.github/workflows/chainloop_init.yml @@ -12,6 +12,9 @@ on: required: false type: string default: main + workflow_name: + required: false + type: string secrets: api_token: required: true @@ -51,3 +54,4 @@ jobs: CHAINLOOP_VERSION: ${{ inputs.chainloop_version }} CHAINLOOP_TOKEN: ${{ secrets.api_token }} CHAINLOOP_CONTRACT_REVISION: ${{ inputs.contract_revision }} + CHAINLOOP_WORKFLOW_NAME: ${{ inputs.workflow_name }} diff --git a/.github/workflows/chainloop_push.yml b/.github/workflows/chainloop_push.yml index e4ddfd2..46e2099 100644 --- a/.github/workflows/chainloop_push.yml +++ b/.github/workflows/chainloop_push.yml @@ -12,6 +12,9 @@ on: required: false type: string default: main + workflow_name: + required: false + type: string secrets: api_token: required: true @@ -92,4 +95,5 @@ jobs: CHAINLOOP_VERSION: ${{ inputs.chainloop_version }} CHAINLOOP_TOKEN: ${{ secrets.api_token }} CHAINLOOP_CONTRACT_REVISION: ${{ inputs.contract_revision }} + CHAINLOOP_WORKFLOW_NAME: ${{ inputs.workflow_name }} diff --git a/tools/c8l b/tools/c8l index 4c57e2d..57b3bf8 100755 --- a/tools/c8l +++ b/tools/c8l @@ -803,7 +803,11 @@ chainloop_attestation_init() { if [ -n "${CHAINLOOP_CONTRACT_REVISION}" ]; then CR_VALUE="--contract-revision ${CHAINLOOP_CONTRACT_REVISION}" fi - r=$(chainloop attestation init -f --remote-state --output json $CR_VALUE) + WF_VALUE="" + if [ -n "${CHAINLOOP_WORKFLOW_NAME}" ]; then + WF_VALUE="--workflow-name ${CHAINLOOP_WORKFLOW_NAME}" + fi + r=$(chainloop attestation init -f --remote-state --output json $CR_VALUE $WF_VALUE) if [ $? -ne 0 ]; then log_error "Chainloop initialization failed: $r" return 1 diff --git a/tools/src/lib/chainloop.sh b/tools/src/lib/chainloop.sh index 5d57aa3..0edac83 100644 --- a/tools/src/lib/chainloop.sh +++ b/tools/src/lib/chainloop.sh @@ -108,7 +108,11 @@ chainloop_attestation_init() { if [ -n "${CHAINLOOP_CONTRACT_REVISION}" ]; then CR_VALUE="--contract-revision ${CHAINLOOP_CONTRACT_REVISION}" fi - r=$(chainloop attestation init -f --remote-state --output json $CR_VALUE) + WF_NAME_VALUE="" + if [ -n "${CHAINLOOP_WORKFLOW_NAME}" ]; then + WF_NAME_VALUE="--workflow-name ${CHAINLOOP_WORKFLOW_NAME}" + fi + r=$(chainloop attestation init -f --remote-state --output json $CR_VALUE $WF_NAME_VALUE) if [ $? -ne 0 ]; then log_error "Chainloop initialization failed: $r" return 1 From a89386a8bd92f613c989c704432ecc510b8885cf Mon Sep 17 00:00:00 2001 From: Javier Rodriguez Date: Tue, 4 Jun 2024 14:19:07 +0200 Subject: [PATCH 2/2] Add missing file Signed-off-by: Javier Rodriguez --- tools/c8l | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/c8l b/tools/c8l index 57b3bf8..14f0ddd 100755 --- a/tools/c8l +++ b/tools/c8l @@ -803,11 +803,11 @@ chainloop_attestation_init() { if [ -n "${CHAINLOOP_CONTRACT_REVISION}" ]; then CR_VALUE="--contract-revision ${CHAINLOOP_CONTRACT_REVISION}" fi - WF_VALUE="" + WF_NAME_VALUE="" if [ -n "${CHAINLOOP_WORKFLOW_NAME}" ]; then - WF_VALUE="--workflow-name ${CHAINLOOP_WORKFLOW_NAME}" + WF_NAME_VALUE="--workflow-name ${CHAINLOOP_WORKFLOW_NAME}" fi - r=$(chainloop attestation init -f --remote-state --output json $CR_VALUE $WF_VALUE) + r=$(chainloop attestation init -f --remote-state --output json $CR_VALUE $WF_NAME_VALUE) if [ $? -ne 0 ]; then log_error "Chainloop initialization failed: $r" return 1