Skip to content

Commit 632b0f7

Browse files
authored
add workflows for cloudpod
add workflows for cloudpod release and testing
2 parents e83c258 + 756c8a8 commit 632b0f7

File tree

12 files changed

+494
-7
lines changed

12 files changed

+494
-7
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "LocalStack DinD setup",
3+
"image": "mcr.microsoft.com/devcontainers/base:jammy",
4+
5+
"remoteEnv": {
6+
// Activate LocalStack Pro: https://docs.localstack.cloud/getting-started/auth-token/
7+
"LOCALSTACK_AUTH_TOKEN": "${localEnv:LOCALSTACK_AUTH_TOKEN}", // required for Pro, not processed via template due to security reasons
8+
"LOCALSTACK_API_KEY": "${localEnv:LOCALSTACK_API_KEY}",
9+
// LocalStack configuration: https://docs.localstack.cloud/references/configuration/
10+
"ACTIVATE_PRO": true,
11+
"DEBUG": true,
12+
"LS_LOG": "trace",
13+
"PERSISTENCE": false,
14+
"AWS_ENDPOINT_URL": "http://localhost.localstack.cloud:4566",
15+
"AUTO_LOAD_POD": "",
16+
"ENFORCE_IAM": false,
17+
"AWS_REGION": "us-east-1",
18+
"AWS_DEFAULT_REGION": "us-east-1",
19+
"IMAGE_NAME": "localstack/localstack-pro:latest",
20+
"LOCALSTACK_VOLUME_DIR": "/data"
21+
},
22+
23+
// 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
24+
"features": {
25+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
26+
"ghcr.io/localstack/devcontainer-feature/localstack-cli:latest": {
27+
"version": "latest",
28+
"awslocal": true, // if true, add in features manually: ghcr.io/devcontainers/features/aws-cli
29+
"cdklocal": true, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/aws-cdk
30+
"pulumilocal": false, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/pulumi
31+
"samlocal": false, // if true, add in features manually: ghcr.io/customink/codespaces-features/sam-cli
32+
"tflocal": false // if true, add in features manually: ghcr.io/devcontainers-contrib/features/terraform-asdf
33+
},
34+
"ghcr.io/devcontainers/features/aws-cli:1": {},
35+
"ghcr.io/devcontainers/features/python:1": {
36+
"version": "3.11"
37+
}
38+
},
39+
40+
// 👇 Use 'postCreateCommand' to run commands after the container is created.
41+
"postCreateCommand": "type localstack; true && localstack start -d || true",
42+
"mounts": [
43+
{
44+
// to persist build data and images
45+
"source": "dind-var-lib-docker",
46+
"target": "/var/lib/docker",
47+
"type": "volume"
48+
},
49+
{
50+
"source": "./.volume",
51+
"target": "/data",
52+
"type": "bind",
53+
"consistency": "cached"
54+
}
55+
]
56+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Keep this folder for DevContainers DooD setup
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM mcr.microsoft.com/devcontainers/base:bookworm
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "LocalStack DooD setup",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
7+
// 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features.
8+
"features": {
9+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
10+
"ghcr.io/localstack/devcontainer-feature/localstack-cli:latest": {
11+
"version": "latest",
12+
"awslocal": true, // if true, add in features manually: ghcr.io/devcontainers/features/aws-cli
13+
"cdklocal": true, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/aws-cdk
14+
"pulumilocal": false, // if true, add in features manually: ghcr.io/devcontainers-contrib/features/pulumi
15+
"samlocal": false, // if true, add in features manually: ghcr.io/customink/codespaces-features/sam-cli
16+
"tflocal": false // if true, add in features manually: ghcr.io/devcontainers-contrib/features/terraform-asdf
17+
},
18+
"ghcr.io/devcontainers/features/aws-cli:1": {},
19+
"ghcr.io/devcontainers/features/python:1": {
20+
"version": "3.11"
21+
}
22+
}
23+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: "3.8"
2+
3+
services:
4+
localstack:
5+
container_name: "localstack-main"
6+
image: localstack/localstack-pro:latest # required for Pro
7+
ports:
8+
- "127.0.0.1:4566:4566" # LocalStack Gateway
9+
- "127.0.0.1:4510-4559:4510-4559" # external services port range
10+
- "127.0.0.1:443:443" # LocalStack HTTPS Gateway (Pro)
11+
env_file:
12+
- .env
13+
volumes:
14+
- "/var/run/docker.sock:/var/run/docker.sock"
15+
- "./.volume:/var/lib/localstack"
16+
networks:
17+
ls:
18+
# Set the container IP address in the info subnet
19+
ipv4_address: 10.0.2.20
20+
21+
app:
22+
build:
23+
context: .
24+
dockerfile: Dockerfile
25+
volumes:
26+
- ../..:/workspaces:cached
27+
# Overrides default command so things don't shut down after the process ends.
28+
command: sleep infinity
29+
init: true
30+
env_file:
31+
- .env
32+
dns:
33+
# Set the DNS server to be the LocalStack container
34+
- 10.0.2.20
35+
networks:
36+
- ls
37+
38+
networks:
39+
ls:
40+
ipam:
41+
config:
42+
# Specify the subnet range for IP address allocation
43+
- subnet: 10.0.2.0/24
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
release-tag:
5+
type: string
6+
required: true
7+
description: This will be the version of the release, but will also be used as 'tag' for the localstack docker image
8+
push:
9+
paths-ignore:
10+
- ./*.md
11+
- LICENSE
12+
- .circleci/*
13+
- .gitlab-ci.yml
14+
branches:
15+
- main
16+
17+
permissions:
18+
contents: write
19+
20+
name: Create Release
21+
jobs:
22+
release:
23+
name: Create Release for Cloud Pod
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
29+
- name: Set up Python 3.11
30+
id: setup-python
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: 3.11
34+
35+
- name: Set up Project
36+
run: |
37+
pip install -e ".[deploy]"
38+
39+
- name: Set up NodeJS 22
40+
id: setup-nodejs
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: 22
44+
45+
- name: Set up CDK Local
46+
id: setup-cdklocal
47+
run: |
48+
npm install -g aws-cdk-local aws-cdk
49+
50+
51+
- name: Start LocalStackV2
52+
uses: LocalStack/[email protected]
53+
with:
54+
image-tag: ${{ inputs.release-tag || 'latest'}}
55+
use-pro: "true"
56+
install-awslocal: "true"
57+
env:
58+
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
59+
60+
- name: Deploy infrastructure
61+
working-directory: deployments/cdk
62+
run: |
63+
cdklocal bootstrap && cdklocal deploy --require-approval never
64+
65+
# Not using action as state is not stored as an artifact
66+
- name: Save the Cloud Pod
67+
env:
68+
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
69+
run: |
70+
localstack state export release-pod.zip
71+
72+
- name: Prepare Release Notes
73+
run: |
74+
echo "This release includes the Cloud Pod of the sample created with LocalStack Version \`${{ inputs.release-tag || 'latest'}}\`." > Release.txt
75+
echo "You can download the \`release-pod.zip\` and inject it manually by running \`localstack state import release-pod.zip\`, or use the Cloud Pods Launchpad." >> Release.txt
76+
echo "### Cloud Pods Launchpad" >> Release.txt
77+
echo "You can click the Launchpad to inject the the pod into your running LocalStack instance using the WebUI:" >> Release.txt
78+
echo "[![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/$GITHUB_REPOSITORY/releases/download/${{ inputs.release-tag || 'latest'}}/release-pod.zip)" >> Release.txt
79+
80+
- name: Create Release
81+
id: create_release
82+
uses: softprops/action-gh-release@v1
83+
with:
84+
tag_name: "${{ inputs.release-tag || 'latest'}}"
85+
name: "Cloud Pod for LocalStack Version '${{ inputs.release-tag || 'latest'}}'"
86+
body_path: ./Release.txt
87+
files: |
88+
./release-pod.zip
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Run Integration Tests
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- ./*.md
7+
- LICENSE
8+
- .circleci/*
9+
- .gitlab-ci.yml
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- main
15+
schedule:
16+
# “At 00:00 on Sunday.”
17+
- cron: "0 0 * * 0"
18+
workflow_dispatch:
19+
inputs:
20+
runner-os:
21+
default: ubuntu-latest
22+
type: choice
23+
options:
24+
- ubuntu-latest
25+
- macos-latest
26+
27+
28+
jobs:
29+
run-it-tests-job:
30+
runs-on: ${{ inputs.runner-os || 'ubuntu-latest' }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
35+
- name: Set up Python 3.11
36+
id: setup-python
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: 3.11
40+
41+
- name: Docker setup (macos only)
42+
id: setup-docker-mac
43+
if: ${{ runner.os == 'macOS' }}
44+
run: |
45+
brew install docker
46+
colima start
47+
48+
- name: Set up Project
49+
run: |
50+
pip install -e ".[deploy,test]"
51+
52+
- name: Start LocalStack
53+
uses: LocalStack/[email protected]
54+
with:
55+
image-tag: 'latest'
56+
use-pro: 'true'
57+
configuration: LS_LOG=trace
58+
install-awslocal: 'true'
59+
env:
60+
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
61+
62+
- name: Set up NodeJS 22
63+
id: setup-nodejs
64+
uses: actions/setup-node@v4
65+
with:
66+
node-version: 22
67+
68+
- name: Set up CDK Local
69+
id: setup-cdklocal
70+
run: |
71+
npm install -g aws-cdk-local aws-cdk
72+
73+
- name: Deploy infrastructure
74+
working-directory: deployments/cdk
75+
run: |
76+
cdklocal bootstrap && cdklocal deploy --require-approval never
77+
78+
- name: Run Tests
79+
env:
80+
AWS_DEFAULT_REGION: us-east-1
81+
AWS_REGION: us-east-1
82+
AWS_ACCESS_KEY_ID: test
83+
AWS_SECRET_ACCESS_KEY: test
84+
run: |
85+
pytest tests
86+
87+
- name: Show localstack logs
88+
if: always()
89+
run: |
90+
localstack logs
91+
92+
- name: Send a Slack notification
93+
if: failure() || github.event_name != 'pull_request'
94+
uses: ravsamhq/notify-slack-action@v2
95+
with:
96+
status: ${{ job.status }}
97+
token: ${{ secrets.GITHUB_TOKEN }}
98+
notification_title: "{workflow} has {status_message}"
99+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
100+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
101+
notify_when: "failure"
102+
env:
103+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
104+
105+
- name: Generate a Diagnostic Report
106+
if: failure()
107+
run: |
108+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
109+
110+
- name: Upload the Diagnostic Report
111+
if: failure()
112+
uses: actions/upload-artifact@v3
113+
with:
114+
name: diagnose.json.gz
115+
path: ./diagnose.json.gz

0 commit comments

Comments
 (0)