This repository was archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from triggermesh/add-ci
implement ci
- Loading branch information
Showing
40 changed files
with
324 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
go: circleci/go@1 | ||
gcp-cli: circleci/gcp-cli@1 | ||
|
||
jobs: | ||
build: | ||
executor: | ||
name: gcp-cli/default | ||
steps: | ||
- checkout | ||
- gcp-cli/install | ||
- gcp-cli/initialize | ||
- run: | ||
name: Building docker image | ||
command: make -j6 cloudbuild-test | ||
|
||
publish-image: | ||
executor: | ||
name: gcp-cli/google | ||
steps: | ||
- checkout | ||
- gcp-cli/initialize | ||
- run: | ||
name: Publishing docker image | ||
command: IMAGE_SHA=${CIRCLE_SHA1} IMAGE_TAG=${CIRCLE_TAG:-latest} make -j6 cloudbuild | ||
|
||
release: | ||
executor: | ||
name: go/default | ||
tag: '1.15' | ||
steps: | ||
- checkout | ||
- run: | ||
name: Installing github-release tool | ||
command: go get github.com/meterup/github-release | ||
- run: | ||
name: Creating github release | ||
command: | | ||
PRE_RELEASE=${CIRCLE_TAG/${CIRCLE_TAG%-rc[0-9]*}/} | ||
github-release delete -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} 2>/dev/null ||: | ||
./scripts/release-notes.sh ${CIRCLE_TAG} | github-release release ${PRE_RELEASE:+-p} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -d - | ||
workflows: | ||
build-test-and-publish: | ||
jobs: | ||
- build: | ||
context: production | ||
filters: | ||
tags: | ||
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ | ||
- publish-image: | ||
context: production | ||
requires: | ||
- build | ||
filters: | ||
tags: | ||
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ | ||
branches: | ||
only: master | ||
- release: | ||
context: production | ||
requires: | ||
- publish-image | ||
filters: | ||
tags: | ||
only: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ | ||
branches: | ||
ignore: /.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
REPO = knative-lambda-runtime | ||
REPO_DESC = TriggerMesh Knative Lambda Runtime | ||
RUNTIMES = java8 node10 node4 python27 python37 ruby25 | ||
|
||
BASE_DIR ?= $(CURDIR) | ||
|
||
DOCKER ?= docker | ||
IMAGE_REPO ?= gcr.io/triggermesh | ||
IMAGE_TAG ?= latest | ||
IMAGE_SHA ?= $(shell git rev-parse HEAD) | ||
|
||
.PHONY: help images cloudbuild-test cloudbuild | ||
|
||
all: images | ||
|
||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*?## "; printf "\n$(REPO_DESC)\nUsage:\n make \033[36m<source>\033[0m\n"} /^[a-zA-Z0-9._-]+:.*?## / {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
||
IMAGES = $(foreach r,$(RUNTIMES),$(r).image) | ||
images: $(IMAGES) ## Build the Docker images | ||
$(IMAGES): %.image: | ||
docker build -t $(IMAGE_REPO)/knative-lambda-$* $* | ||
|
||
CLOUDBUILD_TEST = $(foreach r,$(RUNTIMES),$(r).cloudbuild-test) | ||
cloudbuild-test: $(CLOUDBUILD_TEST) ## Test container image build with Google Cloud Build | ||
$(CLOUDBUILD_TEST): %.cloudbuild-test: | ||
gcloud builds submit $* --config cloudbuild.yaml --substitutions _RUNTIME=knative-lambda-$*,COMMIT_SHA=${IMAGE_SHA},_KANIKO_IMAGE_TAG=_ | ||
|
||
CLOUDBUILD = $(foreach r,$(RUNTIMES),$(r).cloudbuild) | ||
cloudbuild: $(CLOUDBUILD) ## Build and publish image to GCR | ||
$(CLOUDBUILD): %.cloudbuild: | ||
gcloud builds submit $* --config cloudbuild.yaml --substitutions _RUNTIME=knative-lambda-$*,COMMIT_SHA=${IMAGE_SHA},_KANIKO_IMAGE_TAG=${IMAGE_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
steps: | ||
## Build python37 runtime | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-python37:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-python37:latest', '-f' ,'./python-3.7/Dockerfile', '.' ] | ||
|
||
## Build python27 runtime | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-python27:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-python27:latest', '-f' ,'./python-2.7/Dockerfile', '.' ] | ||
- name: gcr.io/kaniko-project/executor:latest | ||
args: | ||
- --dockerfile=Dockerfile | ||
- --build-arg=VERSION=${_KANIKO_IMAGE_TAG} | ||
- --destination=gcr.io/$PROJECT_ID/${_RUNTIME}:${COMMIT_SHA} | ||
- --destination=gcr.io/$PROJECT_ID/${_RUNTIME}:${_KANIKO_IMAGE_TAG} | ||
- --cache-repo=gcr.io/$PROJECT_ID/${_RUNTIME}/cache | ||
- --cache=${_KANIKO_USE_BUILD_CACHE} | ||
- --no-push=${_KANIKO_NO_PUSH} | ||
- ${_KANIKO_EXTRA_ARGS} | ||
waitFor: ['-'] | ||
|
||
## Build node4 runtime | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-node4:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-node4:latest', '-f' ,'./node-4.x/Dockerfile', '.' ] | ||
timeout: 600s | ||
|
||
## Build node10 runtime | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-node10:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-node10:latest', '-f' ,'./node-10.x/Dockerfile', '.' ] | ||
substitutions: | ||
_RUNTIME: | ||
_KANIKO_IMAGE_TAG: latest | ||
_KANIKO_NO_PUSH: 'false' | ||
_KANIKO_USE_BUILD_CACHE: 'true' | ||
_KANIKO_EXTRA_ARGS: | ||
|
||
## Build ruby25 runtime | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-ruby25:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-ruby25:latest', '-f' ,'./ruby-2.5/Dockerfile', '.' ] | ||
options: | ||
substitution_option: ALLOW_LOOSE | ||
|
||
## Build java8 runtime | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-java8:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/knative-lambda-java8:latest', 'java8' ] | ||
|
||
images: | ||
- 'gcr.io/$PROJECT_ID/knative-lambda-python37' | ||
- 'gcr.io/$PROJECT_ID/knative-lambda-python27' | ||
- 'gcr.io/$PROJECT_ID/knative-lambda-node4' | ||
- 'gcr.io/$PROJECT_ID/knative-lambda-node10' | ||
- 'gcr.io/$PROJECT_ID/knative-lambda-ruby25' | ||
- 'gcr.io/$PROJECT_ID/knative-lambda-java8' | ||
tags: | ||
- knative-lambda-runtime |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Dockerfile | ||
.dockerignore | ||
|
||
**/*.md | ||
**/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Dockerfile | ||
.dockerignore | ||
|
||
**/*.md | ||
**/.gitignore |
Oops, something went wrong.