From 57b36dd3da536b79d9ca29a8f9de3842a3b5b940 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Thu, 2 Nov 2023 09:41:44 -0400 Subject: [PATCH] WIP --- .github/workflows/ci.yml | 10 +++++----- action.yml | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1144c0..4e39d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,19 +39,19 @@ jobs: role-to-assume: ${{ secrets.AWS_ROLE }} - id: lock-1 - name: Acquire for 10s + name: Acquire a lock uses: ./ with: name: ${{ env.LOCK_NAME }} - s3-bucket: ${{ env.S3_BUCKET }} + bucket: ${{ env.S3_BUCKET }} expires: 5s - id: lock-2 - name: Wait on lock-1 then acquire + name: Wait on previous lock then acquire our own uses: ./ with: name: ${{ env.LOCK_NAME }} - s3-bucket: ${{ env.S3_BUCKET }} + bucket: ${{ env.S3_BUCKET }} timeout: 10s - name: Verify locks @@ -76,5 +76,5 @@ jobs: uses: ./ with: name: ${{ env.LOCK_NAME }} - s3-bucket: ${{ env.S3_BUCKET }} + bucket: ${{ env.S3_BUCKET }} timeout: 0s diff --git a/action.yml b/action.yml index 48a4f76..e0b8287 100644 --- a/action.yml +++ b/action.yml @@ -3,14 +3,17 @@ description: Wait on, acquire, and clean-up S3-based locks author: "Freckle" inputs: name: - description: "Name for the lock" + description: | + Name for the lock object. Include any prefix you want within the bucket. + The key will be built as "name.created.uuid.expires". required: true - s3-bucket: - description: "Name of existing S3 bucket to use. If empty, one will be created." + bucket: + description: | + Name of an existing S3 bucket to use. required: true expires: description: | - How long to acquire the lock for. Default is 15m. + How long before concurrent operations consider this lock expired. required: true default: 15m timeout: @@ -20,14 +23,14 @@ inputs: required: false timeout-poll: description: | - How long to wait between checks for the lock. Default is 5s. + How long to wait between attempts for the lock. Default is 5s. required: true default: 5s - outputs: + key: + description: "Key of the S3 object representing the lock" acquired-at: - description: "Timestamp of acquisition, or null" - + description: "Timestamp the lock was acquired" runs: using: "node20" main: "dist/acquire/index.js"