Skip to content

Commit 57ed9d6

Browse files
authored
build lambda (#19)
* build lambda * upload with public readability; * test download * fix action
1 parent 15f12eb commit 57ed9d6

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

.github/workflows/lambda.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Lambda
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Checkout the pull request branch
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
# Rebuild README
18+
- name: Prepare
19+
shell: bash
20+
run: |
21+
set -ex
22+
make init
23+
make terraform/install
24+
make terraform/get-plugins
25+
make terraform/get-modules
26+
make terraform/lint
27+
make terraform/validate
28+
29+
- name: Build
30+
run: make build
31+
32+
- name: Deploy
33+
run: aws s3 cp --acl public-read artifacts/lambda.zip s3://artifacts.prod.cloudposse.org/${{ github.event.repository.name }}/${{ github.sha }}/lambda.zip
34+
env:
35+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
36+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
37+
38+
- name: Test Download from CDN
39+
run: curl -fsSL -o /dev/null https://artifacts.cloudposse.com/${{ github.event.repository.name }}/${{ github.sha }}/lambda.zip

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ lint:
1212
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate
1313

1414
define docker
15-
docker run -it -v $(PWD)/$(LAMBDA_DIR)/:/code -w /code $(DEPS_CONTAINER) /bin/sh -c '$(1)'
15+
docker run -i -v $(PWD)/$(LAMBDA_DIR)/:/code -w /code $(DEPS_CONTAINER) /bin/sh -c '$(1)'
1616
endef
1717

1818
## Install dependencies
@@ -28,4 +28,5 @@ dependencies:
2828
build: dependencies
2929
@echo "==> Building Lambda function zip..."
3030
@mkdir -p artifacts
31-
@cd $(LAMBDA_DIR) && zip -r ../artifacts/lambda.zip * && cd ../
31+
@cd $(LAMBDA_DIR) && zip -r ../artifacts/lambda.zip *
32+
@ls -l artifacts/lambda.zip

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
# terraform-aws-lambda-elasticsearch-cleanup
4646

47-
[![Codefresh Build Status](https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-lambda-elasticsearch-cleanup?type=cf-1)](https://g.codefresh.io/public/accounts/cloudposse/pipelines/5eaa33ff1dc82bb99faa3905) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-lambda-elasticsearch-cleanup.svg)](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
47+
[![Codefresh Build Status](https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-lambda-elasticsearch-cleanup?type=cf-1)](https://g.codefresh.io/public/accounts/cloudposse/pipelines/5eaa33ff1dc82bb99faa3905) [![GitHub Action Build Status](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/workflows/Lambda/badge.svg?branch=master)](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/actions?query=workflow%3ALambda) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-lambda-elasticsearch-cleanup.svg)](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
4848

4949

5050
Terraform module to provision a scheduled Lambda function which will

README.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ badges:
2121
- name: "Codefresh Build Status"
2222
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-lambda-elasticsearch-cleanup?type=cf-1"
2323
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/5eaa33ff1dc82bb99faa3905"
24+
- name: "GitHub Action Build Status"
25+
image: "https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/workflows/Lambda/badge.svg?branch=master"
26+
url: "https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/actions?query=workflow%3ALambda"
2427
- name: "Latest Release"
2528
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-lambda-elasticsearch-cleanup.svg"
2629
url: "https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/releases/latest"

0 commit comments

Comments
 (0)