From 1b585d4946d1256fd416662c7a9e371e14f86bee Mon Sep 17 00:00:00 2001 From: Tidhar Meltzer Date: Sun, 13 Jul 2025 11:27:31 +0300 Subject: [PATCH 1/4] feat: Allow specifying a custom Docker image name and registry Signed-off-by: Tidhar Meltzer --- README.md | 1 + action.yml | 5 +++++ startup/action.yml | 22 +++++++++++++++------- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 817a293..28e1fe7 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ with: | `extension-auto-install` | Which extensions to install on startup of LocalStack (application preview) | `None` | | `github-token` | Github token used to create PR comments | | | `image-tag` | Tag of the LocalStack Docker image to use | `latest` | +| `image-name` | Full name of the LocalStack Docker image to use (e.g., `my.registry.com/localstack/localstack:latest`). Overrides `image-tag`. | `''` | | `include-preview` | Whether to include the created Ephemeral Instance URL in the PR comment | `false` | | `install-awslocal` | Whether to install the `awslocal` CLI into the build environment | `true` | | `lifetime` | How long an ephemeral instance should live | 30 | diff --git a/action.yml b/action.yml index 587adc5..02a8c2e 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: description: 'Tag of the LocalStack Docker image to use' required: true default: 'latest' + image-name: + description: 'Full name of the LocalStack Docker image to use (e.g., my.registry.com/localstack/localstack:latest). Overrides image-tag.' + required: false + default: '' install-awslocal: description: 'Whether to install the `awslocal` CLI into the environment' required: true @@ -117,6 +121,7 @@ runs: with: |- { "image-tag": ${{ toJSON(inputs.image-tag) }}, + "image-name": ${{ toJSON(inputs.image-name) }}, "install-awslocal": ${{ toJSON(inputs.install-awslocal) }}, "use-pro": ${{ toJSON(inputs.use-pro) }}, "configuration": ${{ toJSON(inputs.configuration) }}, diff --git a/startup/action.yml b/startup/action.yml index ec88fd5..88f148f 100644 --- a/startup/action.yml +++ b/startup/action.yml @@ -1,10 +1,15 @@ name: 'Start up Localstack' +description: 'Starts up LocalStack container' inputs: image-tag: description: 'Tag of the LocalStack Docker image to use' required: true default: 'latest' + image-name: + description: 'Full name of the LocalStack Docker image to use (e.g., my.registry.com/localstack/localstack:latest). Overrides image-tag.' + required: false + default: '' install-awslocal: description: 'Whether to install the `awslocal` CLI into the environment' required: true @@ -60,14 +65,16 @@ runs: - name: Start LocalStack run: | - if [ "$USE_PRO" = true ]; then - if [ "x$LOCALSTACK_AUTH_TOKEN" = "x" -o "x$LOCALSTACK_API_KEY" = "x" ]; then - echo "WARNING: LocalStack API key not detected, please verify your configuration..." + if [ -z "$IMAGE_NAME" ]; then + if [ "$USE_PRO" = true ]; then + if [ "x$LOCALSTACK_AUTH_TOKEN" = "x" -o "x$LOCALSTACK_API_KEY" = "x" ]; then + echo "WARNING: LocalStack API key not detected, please verify your configuration..." + fi + CONFIGURATION="DNS_ADDRESS=127.0.0.1 ${CONFIGURATION}" + IMAGE_NAME="localstack/localstack-pro:${IMAGE_TAG}" + else + IMAGE_NAME="localstack/localstack:${IMAGE_TAG}" fi - CONFIGURATION="DNS_ADDRESS=127.0.0.1 ${CONFIGURATION}" - IMAGE_NAME="${IMAGE_NAME:-localstack/localstack-pro:${IMAGE_TAG}}" - else - IMAGE_NAME="${IMAGE_NAME:-localstack/localstack:${IMAGE_TAG}}" fi CONFIGURATION="IMAGE_NAME=${IMAGE_NAME} ${CONFIGURATION}" @@ -82,6 +89,7 @@ runs: shell: bash env: IMAGE_TAG: ${{ inputs.image-tag }} + IMAGE_NAME: ${{ inputs.image-name }} INSTALL_AWSLOCAL: ${{ inputs.install-awslocal }} USE_PRO: ${{ inputs.use-pro }} CONFIGURATION: ${{ inputs.configuration }} From 3f9c147151a96b85ae1a72cb60d1f0935506c9bf Mon Sep 17 00:00:00 2001 From: Tidhar Meltzer Date: Sun, 13 Jul 2025 12:26:41 +0300 Subject: [PATCH 2/4] Update GH_ACTION_ROOT Signed-off-by: Tidhar Meltzer --- action.yml | 11 +---------- ephemeral/startup/action.yml | 12 ++---------- startup/action.yml | 11 +---------- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/action.yml b/action.yml index 02a8c2e..374557e 100644 --- a/action.yml +++ b/action.yml @@ -88,16 +88,7 @@ inputs: runs: using: "composite" steps: - - run: > - echo "GH_ACTION_ROOT=$( - ls -d $( - ls -d ./../../_actions/* | - grep -i localstack | - tail -n1 - )/setup-localstack/* | - grep -v completed | - tail -n1 - )" >> $GITHUB_ENV + - run: echo "GH_ACTION_ROOT=${{ github.action_path }}" >> $GITHUB_ENV shell: bash - name: Install tools diff --git a/ephemeral/startup/action.yml b/ephemeral/startup/action.yml index 5a580b3..bd8f42a 100644 --- a/ephemeral/startup/action.yml +++ b/ephemeral/startup/action.yml @@ -1,4 +1,5 @@ name: Create PR Preview +description: 'Creates a preview environment for a pull request.' inputs: github-token: @@ -28,16 +29,7 @@ inputs: runs: using: composite steps: - - run: > - echo "GH_ACTION_ROOT=$( - ls -d $( - ls -d ./../../_actions/* | - grep -i localstack | - tail -n1 - )/setup-localstack/* | - grep -v completed | - tail -n1 - )" >> $GITHUB_ENV + - run: echo "GH_ACTION_ROOT=${{ github.action_path }}" >> $GITHUB_ENV shell: bash - name: Initial PR comment diff --git a/startup/action.yml b/startup/action.yml index 88f148f..69c80e2 100644 --- a/startup/action.yml +++ b/startup/action.yml @@ -42,16 +42,7 @@ runs: # with: # github-token: ${{ inputs.github-token }} # ci-project: ${{ inputs.ci-project }} - - run: > - echo "GH_ACTION_ROOT=$( - ls -d $( - ls -d ./../../_actions/* | - grep -i localstack | - tail -n1 - )/setup-localstack/* | - grep -v completed | - tail -n1 - )" >> $GITHUB_ENV + - run: echo "GH_ACTION_ROOT=${{ github.action_path }}" >> $GITHUB_ENV shell: bash - name: Install tools From 9e332db7de9ceafbcfabe2962d426cb7ac3a7f8f Mon Sep 17 00:00:00 2001 From: Tidhar Meltzer Date: Sun, 13 Jul 2025 13:39:23 +0300 Subject: [PATCH 3/4] Update GH_ACTION_ROOT Signed-off-by: Tidhar Meltzer --- action.yml | 2 +- ephemeral/startup/action.yml | 2 +- startup/action.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 374557e..74f93d4 100644 --- a/action.yml +++ b/action.yml @@ -88,7 +88,7 @@ inputs: runs: using: "composite" steps: - - run: echo "GH_ACTION_ROOT=${{ github.action_path }}" >> $GITHUB_ENV + - run: echo "GH_ACTION_ROOT=${{ github.action_repository }}@${{ github.sha }}" >> $GITHUB_ENV shell: bash - name: Install tools diff --git a/ephemeral/startup/action.yml b/ephemeral/startup/action.yml index bd8f42a..2c52668 100644 --- a/ephemeral/startup/action.yml +++ b/ephemeral/startup/action.yml @@ -29,7 +29,7 @@ inputs: runs: using: composite steps: - - run: echo "GH_ACTION_ROOT=${{ github.action_path }}" >> $GITHUB_ENV + - run: echo "GH_ACTION_ROOT=${{ github.action_repository }}@${{ github.sha }}" >> $GITHUB_ENV shell: bash - name: Initial PR comment diff --git a/startup/action.yml b/startup/action.yml index 69c80e2..7376a16 100644 --- a/startup/action.yml +++ b/startup/action.yml @@ -42,7 +42,7 @@ runs: # with: # github-token: ${{ inputs.github-token }} # ci-project: ${{ inputs.ci-project }} - - run: echo "GH_ACTION_ROOT=${{ github.action_path }}" >> $GITHUB_ENV + - run: echo "GH_ACTION_ROOT=${{ github.action_repository }}@${{ github.sha }}" >> $GITHUB_ENV shell: bash - name: Install tools From eb46ae10b4cec4e5e1679f3bb10808cbf6739288 Mon Sep 17 00:00:00 2001 From: Tidhar Meltzer Date: Sun, 13 Jul 2025 13:45:55 +0300 Subject: [PATCH 4/4] Restore GH_ACTION_ROOT Signed-off-by: Tidhar Meltzer --- action.yml | 11 ++++++++++- ephemeral/startup/action.yml | 11 ++++++++++- startup/action.yml | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 74f93d4..02a8c2e 100644 --- a/action.yml +++ b/action.yml @@ -88,7 +88,16 @@ inputs: runs: using: "composite" steps: - - run: echo "GH_ACTION_ROOT=${{ github.action_repository }}@${{ github.sha }}" >> $GITHUB_ENV + - run: > + echo "GH_ACTION_ROOT=$( + ls -d $( + ls -d ./../../_actions/* | + grep -i localstack | + tail -n1 + )/setup-localstack/* | + grep -v completed | + tail -n1 + )" >> $GITHUB_ENV shell: bash - name: Install tools diff --git a/ephemeral/startup/action.yml b/ephemeral/startup/action.yml index 2c52668..1d1f8e4 100644 --- a/ephemeral/startup/action.yml +++ b/ephemeral/startup/action.yml @@ -29,7 +29,16 @@ inputs: runs: using: composite steps: - - run: echo "GH_ACTION_ROOT=${{ github.action_repository }}@${{ github.sha }}" >> $GITHUB_ENV + - run: > + echo "GH_ACTION_ROOT=$( + ls -d $( + ls -d ./../../_actions/* | + grep -i localstack | + tail -n1 + )/setup-localstack/* | + grep -v completed | + tail -n1 + )" >> $GITHUB_ENV shell: bash - name: Initial PR comment diff --git a/startup/action.yml b/startup/action.yml index 7376a16..88f148f 100644 --- a/startup/action.yml +++ b/startup/action.yml @@ -42,7 +42,16 @@ runs: # with: # github-token: ${{ inputs.github-token }} # ci-project: ${{ inputs.ci-project }} - - run: echo "GH_ACTION_ROOT=${{ github.action_repository }}@${{ github.sha }}" >> $GITHUB_ENV + - run: > + echo "GH_ACTION_ROOT=$( + ls -d $( + ls -d ./../../_actions/* | + grep -i localstack | + tail -n1 + )/setup-localstack/* | + grep -v completed | + tail -n1 + )" >> $GITHUB_ENV shell: bash - name: Install tools