Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify GH workflow to always publish to latest #90

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
363b0ef
feat: initial changes after the fork
zamazan4ik Aug 18, 2021
3a81d04
doc: update README
zamazan4ik Aug 18, 2021
979a983
Fix test image reference
micrictor Aug 22, 2021
e7e54b8
Rework GH actions to CD latest, tag on release
micrictor Aug 22, 2021
a43db23
Merge pull request #2 from micrictor/master
zamazan4ik Aug 25, 2021
4aef9db
Makefile updated to use Rust 1.55.0 as the default version
jerusdp Sep 9, 2021
049a8b7
Update change log for Rust version 1.55.0
jerusdp Sep 10, 2021
14cb020
merge: Merge pull request #3 from jerusdp/rust-1.55.0
zamazan4ik Sep 10, 2021
435fd2a
merge: Merge pull request #4 from jerusdp/master
zamazan4ik Sep 10, 2021
2cf247b
fix: fix publishing releases
zamazan4ik Sep 10, 2021
b31e262
Add .vscode to ignored files
jerusdp Sep 13, 2021
7f0e12e
Script to check cersion
jerusdp Sep 13, 2021
18f24ac
Check the latest R build
jerusdp Sep 13, 2021
2c5cec8
Check the Rust version
jerusdp Sep 13, 2021
b45f571
Schedule Github Actions Version Check
jerusdp Sep 13, 2021
1cb9025
FIX: On speficication
jerusdp Sep 13, 2021
54b76fb
Update check.yml
jerusdp Sep 13, 2021
afdedec
Merge pull request #1 from jerusdp/latest
jerusdp Sep 13, 2021
b511fbd
Test using my docker
jerusdp Sep 13, 2021
a8a2778
Scheduled test for top of next hour
jerusdp Sep 13, 2021
5788290
manual trigger option
jerusdp Sep 13, 2021
7980f14
Update check.yml
jerusdp Sep 13, 2021
031cf8d
Create an issue
jerusdp Sep 13, 2021
22dd6f8
Merge branch 'master' of github.com:jerusdp/lambda-rust
jerusdp Sep 13, 2021
07d006b
Update check.yml
jerusdp Sep 13, 2021
b2b6e24
Update check.yml
jerusdp Sep 13, 2021
c29d947
Update check.yml
jerusdp Sep 13, 2021
25f1118
Update check.yml
jerusdp Sep 13, 2021
25009e1
Update check.yml
jerusdp Sep 13, 2021
28970f9
Update check.yml
jerusdp Sep 13, 2021
f94da9e
Update check.yml
jerusdp Sep 13, 2021
82e5485
Update check.yml
jerusdp Sep 13, 2021
4cbb4ce
Update check.yml
jerusdp Sep 13, 2021
2ef0d93
FIX: Update to write issue on failure
jerusdp Sep 13, 2021
7a23dbb
Subject
jerusdp Sep 13, 2021
c45e592
FIX - too much copying :(
jerusdp Sep 13, 2021
78e507d
echo stable
jerusdp Sep 13, 2021
41a8ce5
attempt to use gh to create the issue within the shell script
jerusdp Sep 13, 2021
2abdf53
Wrong variable being transferred
jerusdp Sep 13, 2021
10a671d
Use gh instead of action
jerusdp Sep 13, 2021
ba1cdf0
Use gh instead of action
jerusdp Sep 13, 2021
6f55fa8
FIX missing step indicator
jerusdp Sep 13, 2021
a9f159f
FIXadd checkout to get auth?
jerusdp Sep 13, 2021
98f58ee
FIX: Add environment with GITHUB_TOKEN
jerusdp Sep 13, 2021
c9d8ee0
FIX: Use gh to clone instead of checkout
jerusdp Sep 13, 2021
a78ce53
FIX Use checkout
jerusdp Sep 13, 2021
340b481
Add label to issue
jerusdp Sep 13, 2021
dc545df
Change label to existing lable
jerusdp Sep 14, 2021
2c86d65
Create issue on the repository without checking out by using -R flag
jerusdp Sep 14, 2021
9c19ad7
FIX spelling of workflow_dispatch
jerusdp Sep 14, 2021
ae04609
Merge branch 'master' into latest
jerusdp Sep 14, 2021
e615839
FIX wayward space in -R
jerusdp Sep 14, 2021
58599b9
Merge branch 'latest' of github.com:jerusdp/lambda-rust into latest
jerusdp Sep 14, 2021
59d3085
Update cron schedule to run early Tuesday morning
jerusdp Sep 14, 2021
c54e3a3
Restore Makefile after testing
jerusdp Sep 14, 2021
4640e2d
Conditional execution of publish on the correct public repository
jerusdp Sep 17, 2021
a37f565
Use github.repository to set REPO
jerusdp Sep 17, 2021
67cc806
Update main to include security scan and address issue #6
jerusdp Sep 17, 2021
81ac9b0
Remove original version of kernel-devel as its not updated by yum and…
jerusdp Sep 17, 2021
2b9e5e8
Update environent variable setting
jerusdp Sep 17, 2021
8494333
Add .vscode to gitignore and delete seurity.yml working file
jerusdp Sep 17, 2021
5715270
FIX: Correct the name of the master repository to rust-serverless/lam…
jerusdp Sep 17, 2021
9c22b3d
Added workflow to build nightly Rust each night at 0200
jerusdp Sep 19, 2021
fe4b201
Nigthly make script to build and push nightly Rust
jerusdp Sep 19, 2021
dc9cce0
Set IMAGE based on enirvonment or default
jerusdp Sep 20, 2021
b934a75
Add Tag to Makefile
jerusdp Sep 20, 2021
507fdc7
Build and Publish Nightly Rust
jerusdp Sep 20, 2021
800f52f
FIX: double quotes to single quotes
jerusdp Sep 20, 2021
b9ac56a
FIX: test needs to use the nigthly container image
jerusdp Sep 20, 2021
15367fa
FIX: need to build before test
jerusdp Sep 20, 2021
02beee0
Added newline to nightly.yml
jerusdp Sep 30, 2021
a6093d0
merge: Merge pull request #9 from jerusdp/nightly
zamazan4ik Sep 30, 2021
438171c
Added missing newlines
jerusdp Sep 30, 2021
680fa57
Added missing newlines
jerusdp Sep 30, 2021
5bc6605
Resolve conflict with Makefile updated by nightly
jerusdp Sep 30, 2021
1642087
Merge branch 'master' into latest
jerusdp Sep 30, 2021
8c4e25c
Added missing newlines
jerusdp Sep 30, 2021
0634320
merge: Merge pull request #7 from jerusdp/secruity
zamazan4ik Sep 30, 2021
764b9d1
merge: Merge pull request #8 from jerusdp/latest
zamazan4ik Sep 30, 2021
2924262
Add autobuild to stable
micrictor Oct 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tests
.git
.git
23 changes: 23 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 3'

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Check Rust Version
- run: make check
create_issue:
runs-on: ubuntu-latest
needs: check
if: always() && (needs.check.result == 'failure')
steps:
- run: gh issue create --title "Time to update to Rust" --body "Build update for next version of Rust" --label "enhancement" -R $GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

48 changes: 27 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,48 @@ on:
push:
branches:
- master
tags:
- 'v**'
pull_request:
branches:
- master

jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build
env:
REPO: ${{ github.repository }}
shell: bash
run: |
echo "docker_repo=${{ env.REPO }}" >> $GITHUB_ENV
make build
- name: Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: '${{ env.docker_repo }}:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build
shell: bash
run: make build
- name: Test
run: make test
publish-docs:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Update Docker hub metadata
uses: docker://mpepping/docker-hub-metadata-github-action
env:
IMAGE: ${{ github.repository }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
continue-on-error: true
publish:
needs: [test]
needs: [scan, test]
if: github.repository == 'rust-serverless/lambda-rust'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build
shell: bash
run: make build
- name: Publish
if: startsWith(github.ref, 'refs/tags/')
- name: Publish Latest
shell: bash
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
make publish
make publish
38 changes: 38 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Nightly Rust

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * 3'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
make build
make test
env:
RUST_VERSION: nightly
TAG: nightly
IMAGE: 'rustserverless/lambda-rust:nightly'
publish:
needs: [test]
if: github.repository == 'rust-serverless/lambda-rust'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make publish
env:
RUST_VERSION: nightly
TAG: nightly
create_issue:
runs-on: ubuntu-latest
needs: [publish]
if: always() && (needs.publish.result == 'failure')
steps:
- run: gh issue create --title "Nightly publication failed" --body "Nightly publication failed" --label "bug" -R $GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release publishing

on:
release:
types:
- published

jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Update Docker hub metadata
uses: docker://mpepping/docker-hub-metadata-github-action
env:
IMAGE: rustserverless/lambda-rust
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
continue-on-error: true
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build
shell: bash
run: make build
- name: Publish
shell: bash
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
make publish-tag
35 changes: 35 additions & 0 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Stable Rust

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * 3'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
make build
make test
env:
RUST_VERSION: stable
publish:
needs: [test]
if: github.repository == 'rust-serverless/lambda-rust'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make publish-tag
env:
RUST_VERSION: stable
create_issue:
runs-on: ubuntu-latest
needs: [publish]
if: always() && (needs.publish.result == 'failure')
steps:
- run: gh issue create --title "Stable publication failed" --body "Stable publication failed" --label "bug" -R $GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

14 changes: 14 additions & 0 deletions .github/workflows/untrusted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Untrusted workflows (PRs)

on:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Test
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tests/test-*/test-out.log
target
.DS_Store
.vscode
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.4.0-rust-1.55.0

* Upgrade to Rust [`1.55.0`](https://blog.rust-lang.org/2021/09/09/Rust-1.55.0.html)

# 0.4.0-rust-1.54.0

* Upgrade to Rust [`1.54.0`](https://blog.rust-lang.org/2021/07/29/Rust-1.54.0.html)

# 0.4.0-rust-1.45.2

* **Breaking change** in avoid mixed user permissions when volume mounting cargo cache directories. This docker images now configures a cargo installation to `/cargo` directory rather than `/home/root/.cargo`. You'll also want to ensure
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# https://github.com/lambci/docker-lambda#documentation
FROM lambci/lambda:build-provided.al2
FROM docker.io/lambci/lambda:build-provided.al2

ARG RUST_VERSION=1.51.0
ARG RUST_VERSION=1.54.0
RUN yum -y update
RUN yum -y remove kernel-devel-4.14.203-156.332.amzn2
RUN yum install -y jq openssl-devel
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| CARGO_HOME=/cargo RUSTUP_HOME=/rustup sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION
ADD build.sh /usr/local/bin/
ADD latest.sh /usr/local/bin/
VOLUME ["/code"]
WORKDIR /code
ENTRYPOINT ["/usr/local/bin/build.sh"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 Doug Tangren
Copyright (c) 2020 Doug Tangren, 2021 Alexander Zaitsev

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
30 changes: 19 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
VERSION ?= 0.4.0
RUST_VERSION ?= 1.51.0
REPO ?= softprops/lambda-rust
TAG ?= "$(REPO):$(VERSION)-rust-$(RUST_VERSION)"
DOCKER ?= docker
INPUT_RELEASE_VERSION ?= 0.4.0
RUST_VERSION ?= 1.55.0
REPO ?= rustserverless/lambda-rust
TAG ?= latest

publish: build
@docker push $(TAG)
@docker push $(REPO):latest
$(DOCKER) push $(REPO):${TAG}

publish-tag: build publish
$(DOCKER) tag $(REPO):${TAG} "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)"
$(DOCKER) push "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)"

build:
@docker build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(TAG) .
@docker tag $(TAG) $(REPO):latest
$(DOCKER) build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(REPO):${TAG} .

test: build
test:
@tests/test.sh

debug: build
@docker run --rm -it \
$(DOCKER) run --rm -it \
-u $(id -u):$(id -g) \
-v ${PWD}:/code \
-v ${PWD}:/code:Z \
-v ${HOME}/.cargo/registry:/cargo/registry \
-v ${HOME}/.cargo/git:/cargo/git \
--entrypoint=/bin/bash \
$(REPO):$(TAG)

check:
$(DOCKER) run --rm \
--entrypoint=/usr/local/bin/latest.sh \
$(REPO)
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AWS Lambda [Rust](https://www.rust-lang.org/) docker builder 🐑 🦀 🐳 [![Build Status](https://github.com/softprops/lambda-rust/workflows/Main/badge.svg)](https://github.com/softprops/lambda-rust/actions)
# AWS Lambda [Rust](https://www.rust-lang.org/) docker builder 🐑 🦀 🐳 [![Build Status](https://github.com/rust-serverless/lambda-rust/workflows/Main/badge.svg)](https://github.com/rust-serverless/lambda-rust/actions)


## 🤔 about
Expand All @@ -10,14 +10,14 @@ This provides a build environment, consistent with your target execution environ

## 📦 install

Tags for this docker image follow the naming convention `softprops/lambda-rust:{version}-rust-{rust-stable-version}`
Tags for this docker image follow the naming convention `rustserverless/lambda-rust:{version}-rust-{rust-stable-version}`
where `{rust-stable-version}` is a stable version of rust.

You can find a list of available docker tags [here](https://hub.docker.com/r/softprops/lambda-rust/tags)
You can find a list of available docker tags [here](https://hub.docker.com/r/rustserverless/lambda-rust/tags)

> 💡 If you don't find the version you're looking for, please [open a new github issue](https://github.com/softprops/lambda-rust/issues/new?title=I%27m%20looking%20for%20version%20xxx) to publish one
> 💡 If you don't find the version you're looking for, please [open a new github issue](https://github.com/rust-serverless/lambda-rust/issues/new?title=I%27m%20looking%20for%20version%20xxx) to publish one

You can also depend directly on `softprops/lambda-rust:latest` for the most recently published version.
You can also depend directly on `rustserverless/lambda-rust:latest` for the most recently published version.

## 🤸 usage

Expand Down Expand Up @@ -45,7 +45,7 @@ $ docker run --rm \
-v ${PWD}:/code \
-v ${HOME}/.cargo/registry:/cargo/registry \
-v ${HOME}/.cargo/git:/cargo/git \
softprops/lambda-rust
rustserverless/lambda-rust
```
> 💡 The -v (volume mount) flags for `/cargo/{registry,git}` are optional but when supplied, provides a much faster turn around when doing iterative development

Expand All @@ -68,7 +68,7 @@ $ docker run --rm \
-v ${PWD}:/code \
-v ${HOME}/.cargo/registry:/cargo/registry \
-v ${HOME}/.cargo/git:/cargo/git \
softprops/lambda-rust
rustserverless/lambda-rust
```

For more custom codebases, the '-w' argument can be used to override the working directory.
Expand All @@ -82,7 +82,7 @@ $ docker run --rm \
-v ${HOME}/.cargo/registry:/cargo/registry \
-v ${HOME}/.cargo/git:/cargo/git \
-w /code/lambdas/mylambda \
softprops/lambda-rust
rustserverless/lambda-rust
```

## ⚓ using hooks
Expand Down Expand Up @@ -120,7 +120,7 @@ docker run \
-v ${PWD}:/code \
-v ${HOME}/.cargo/registry:/cargo/registry \
-v ${HOME}/.cargo/git:/cargo/git \
softprops/lambda-rust
rustserverless/lambda-rust

# start a one-off docker container replicating the "provided.al2" lambda runtime
# awaiting an event to be provided via stdin
Expand Down Expand Up @@ -197,4 +197,5 @@ $ cargo aws-lambda --help
More instructions can be found [here](https://github.com/vvilhonen/cargo-aws-lambda).


Doug Tangren (softprops) 2020
Doug Tangren ([softprops](https://github.com/softprops)) 2020, Alexander Zaitsev ([zamazan4ik](https://github.com/zamazan4ik)) 2021

15 changes: 15 additions & 0 deletions latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -eux

export CARGO_HOME="/cargo"
export RUSTUP_HOME="/rustup"

# shellcheck disable=SC1091
source /cargo/env

rustup toolchain install stable --profile=minimal
STABLE=$(rustup check | grep stable | grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o)
DEFAULT=$(rustup show | grep -m 1 default | grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o)

if [ "${STABLE}" == "${DEFAULT}" ]; then exit 0
else exit 1
fi
Loading