-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathaction.yml
More file actions
97 lines (89 loc) · 3.08 KB
/
action.yml
File metadata and controls
97 lines (89 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
default: 'true'
use-pro:
description: 'Whether to use LocalStack Pro (requires a valid API key)'
required: false
default: 'false'
configuration:
description: 'Configuration variables to use for LocalStack'
required: false
default: ''
ci-project:
description: 'Name of the CI project to track in LocalStack Cloud'
required: false
default: ''
skip-wait:
description: 'Skip wait for LocalStack'
required: false
default: 'false'
runs:
using: "composite"
steps:
# # NOTE: Thinking about this if we need it
# - name: Initial PR comment
# # TODO: potentially replace with Action version number over time
# uses: LocalStack/setup-localstack/prepare@main
# if: inputs.ci-project && inputs.github-token
# 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
shell: bash
- name: Install tools
uses: jenseng/dynamic-uses@v1
with:
uses: ${{ env.GH_ACTION_ROOT }}/tools
with: |-
{
"install-awslocal": ${{ toJSON(inputs.install-awslocal) }},
}
- name: Start LocalStack
run: |
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
fi
CONFIGURATION="IMAGE_NAME=${IMAGE_NAME} ${CONFIGURATION}"
docker pull ${IMAGE_NAME} &
export CI_PROJECT=${{ inputs.ci-project }}
eval "${CONFIGURATION} localstack start -d"
if [ "$SKIP_WAIT" = false ]; then
localstack wait -t ${LS_WAIT_TIMEOUT:-30} # Let users configure the timeout via env variable
fi
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 }}
SKIP_WAIT: ${{ inputs.skip-wait }}