This repository was archived by the owner on May 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,140 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
python: circleci/python@1 | ||
go: circleci/go@1 | ||
gcp-cli: circleci/gcp-cli@1 | ||
|
||
jobs: | ||
build: | ||
executor: | ||
name: python/default | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- checkout | ||
- run: pip install mkdocs | ||
- run: | ||
name: Building package | ||
command: make build | ||
- gcp-cli/install | ||
- gcp-cli/initialize | ||
- run: | ||
name: Building docker image | ||
command: make cloudbuild-test | ||
- persist_to_workspace: | ||
root: ~/ | ||
paths: | ||
- project | ||
|
||
publish-image: | ||
executor: | ||
name: gcp-cli/google | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- gcp-cli/initialize | ||
- run: | ||
name: Publishing docker image | ||
command: IMAGE_SHA=${CIRCLE_SHA1} IMAGE_TAG=${CIRCLE_TAG:-latest} make cloudbuild | ||
|
||
release: | ||
executor: | ||
name: go/default | ||
tag: '1.15' | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- run: | ||
name: Building release package | ||
command: make release | ||
environment: | ||
DIST_DIR: /tmp/dist | ||
- 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 - | ||
for f in $(find /tmp/dist -type f); do github-release upload -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -n $(basename ${f}) -f ${f} ; done | ||
|
||
deploy: | ||
description: Patches target cluster configuration | ||
executor: | ||
name: go/default | ||
tag: '1.15' | ||
parameters: | ||
cluster: | ||
type: string | ||
committer_name: | ||
type: string | ||
default: TriggerMesh Bot | ||
committer_email: | ||
type: string | ||
default: bot@triggermesh.com | ||
steps: | ||
- attach_workspace: | ||
at: ~/ | ||
- add_ssh_keys | ||
- run: ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
- run: | ||
name: Configuring git | ||
command: | | ||
git config --global user.name '<< parameters.committer_name >>' | ||
git config --global user.email '<< parameters.committer_email >>' | ||
- run: | ||
name: Cloning config repository | ||
command: git clone --single-branch git@github.com:triggermesh/config.git tmconfig | ||
- run: | ||
name: Updating overlays/<< parameters.cluster >>/sources manifests | ||
working_directory: tmconfig/ | ||
command: | | ||
sed -i overlays/<< parameters.cluster >>/docs/deployment.yaml -e "s|gcr.io/triggermesh/docs:.*|gcr.io/triggermesh/docs:"${CIRCLE_TAG:-${CIRCLE_SHA1}}"|g" | ||
git --no-pager diff | ||
- run: | ||
name: Committing overlays/<< parameters.cluster >>/docs updates | ||
working_directory: tmconfig/ | ||
command: | | ||
git add overlays | ||
git commit -m "Update overlays/<< parameters.cluster >>/docs deployment to '${CIRCLE_TAG:-${CIRCLE_SHA1}}'" | ||
git push origin master | ||
|
||
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 | ||
- deploy: | ||
name: update-production-config | ||
cluster: prod | ||
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: /.*/ | ||
- 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 hidden or 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,8 @@ | ||
# Top level files and directories | ||
/.circleci/ | ||
/.dockerignore | ||
/.gcloudignore | ||
/.git/ | ||
/_output/ | ||
/cloudbuild.yaml | ||
/Dockerfile |
This file contains hidden or 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,2 @@ | ||
#!include:.dockerignore | ||
!Dockerfile |
This file contains hidden or 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,3 +1,18 @@ | ||
/site | ||
/.venv | ||
**/.DS_Store | ||
# Local configurations and secrets | ||
/.env/ | ||
/.local/ | ||
|
||
# Continuous integration | ||
|
||
# Editors and IDEs | ||
*.swo | ||
*.swp | ||
*~ | ||
/*.sublime-project | ||
/*.sublime-workspace | ||
/.DS_Store | ||
/.idea/ | ||
/.vscode/ | ||
|
||
# Build artifacts | ||
**/_output |
This file contains hidden or 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,4 +1,11 @@ | ||
FROM nginx | ||
FROM python:3 AS builder | ||
|
||
RUN pip install mkdocs | ||
|
||
COPY . /docs | ||
|
||
ADD site/ /usr/share/nginx/html/ | ||
RUN mkdocs build --clean --config-file /docs/mkdocs.yml | ||
|
||
FROM nginx | ||
|
||
COPY --from=builder /docs/site/ /usr/share/nginx/html/ |
This file contains hidden or 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,50 @@ | ||
PACKAGE = docs | ||
PACKAGE_DESC = Triggermesh Docs | ||
VERSION ?= $(shell git describe --tags --always) | ||
|
||
BASE_DIR ?= $(CURDIR) | ||
|
||
OUTPUT_DIR ?= $(BASE_DIR)/_output | ||
DIST_DIR ?= $(OUTPUT_DIR) | ||
|
||
SITE_OUTPUT_DIR ?= $(OUTPUT_DIR)/site | ||
|
||
DOCKER ?= docker | ||
|
||
IMAGE_REPO ?= gcr.io/triggermesh | ||
IMAGE_TAG ?= latest | ||
IMAGE_SHA ?= $(shell git rev-parse HEAD) | ||
|
||
HAS_MKDOCS := $(shell command -v mkdocs;) | ||
|
||
.PHONY: help build image cloudbuild-test cloudbuild clean | ||
|
||
all: build | ||
|
||
install-mkdocs: | ||
ifndef HAS_MKDOCS | ||
pip3 install mkdocs | ||
endif | ||
|
||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*?## "; printf "\n$(PACKAGE_DESC)\n\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) | ||
|
||
build: install-mkdocs ## Build the docs | ||
mkdocs build --clean --config-file mkdocs.yml --site-dir $(SITE_OUTPUT_DIR) | ||
|
||
release: ## Build distribution tarball | ||
@mkdir -p $(DIST_DIR) | ||
tar -jcf $(DIST_DIR)/$(PACKAGE)-$(VERSION).tar.bz2 -C $$(dirname $(SITE_OUTPUT_DIR)) $$(basename $(SITE_OUTPUT_DIR)) | ||
|
||
image: ## Builds the container image | ||
$(DOCKER) build -t $(IMAGE_REPO)/$(PACKAGE) -f Dockerfile . | ||
|
||
cloudbuild-test: ## Test container image build with Google Cloud Build | ||
gcloud builds submit $(BASE_DIR) --config cloudbuild.yaml --substitutions COMMIT_SHA=${IMAGE_SHA},_KANIKO_IMAGE_TAG=_ | ||
|
||
cloudbuild: ## Build and publish image to GCR | ||
gcloud builds submit $(BASE_DIR) --config cloudbuild.yaml --substitutions COMMIT_SHA=${IMAGE_SHA},_KANIKO_IMAGE_TAG=${IMAGE_TAG} | ||
|
||
clean: ## Clean build artifacts | ||
@$(RM) -v $(DIST_DIR)/$(PACKAGE)-$(VERSION).tar.bz2 | ||
@$(RM) -rv $(SITE_OUTPUT_DIR) |
This file contains hidden or 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,10 +1,28 @@ | ||
steps: | ||
- name: 'gcr.io/triggermesh/mkdocs:latest' | ||
args: ['mkdocs', 'build'] | ||
- name: 'debian' | ||
args: ['ls', '/workspace/site'] | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: ['build', '-t', 'gcr.io/$PROJECT_ID/www:$REVISION_ID', '-t', 'gcr.io/$PROJECT_ID/www:latest', '.'] | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: ['push', 'gcr.io/$PROJECT_ID/www:$REVISION_ID'] | ||
images: ['gcr.io/$PROJECT_ID/www'] | ||
|
||
- name: gcr.io/kaniko-project/executor:latest | ||
args: | ||
- --dockerfile=Dockerfile | ||
- --destination=gcr.io/$PROJECT_ID/docs:${COMMIT_SHA} | ||
- --destination=gcr.io/$PROJECT_ID/docs:${_KANIKO_IMAGE_TAG} | ||
- --cache-repo=gcr.io/$PROJECT_ID/docs/cache | ||
- --cache=${_KANIKO_USE_BUILD_CACHE} | ||
- --no-push=${_KANIKO_NO_PUSH} | ||
- --snapshotMode=redo | ||
- --use-new-run | ||
- ${_KANIKO_EXTRA_ARGS} | ||
waitFor: ['-'] | ||
|
||
timeout: 120s | ||
|
||
substitutions: | ||
_KANIKO_IMAGE_TAG: latest | ||
_KANIKO_NO_PUSH: 'false' | ||
_KANIKO_USE_BUILD_CACHE: 'true' | ||
_KANIKO_EXTRA_ARGS: | ||
|
||
options: | ||
substitution_option: ALLOW_LOOSE | ||
|
||
tags: | ||
- docs |
This file contains hidden or 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,38 @@ | ||
#!/usr/bin/env sh | ||
|
||
RELEASE=${1:-${GIT_TAG}} | ||
RELEASE=${RELEASE:-${CIRCLE_TAG}} | ||
|
||
if [ -z "${RELEASE}" ]; then | ||
echo "Usage:" | ||
echo "./scripts/release-notes.sh v0.1.0" | ||
exit 1 | ||
fi | ||
|
||
if ! git rev-list ${RELEASE} >/dev/null 2>&1; then | ||
echo "${RELEASE} does not exist" | ||
exit | ||
fi | ||
|
||
PREV_RELEASE=${PREV_RELEASE:-$(git describe --tags --abbrev=0 ${RELEASE}^ 2>/dev/null)} | ||
PREV_RELEASE=${PREV_RELEASE:-$(git rev-list --max-parents=0 ${RELEASE}^ 2>/dev/null)} | ||
NOTABLE_CHANGES=$(git cat-file -p ${RELEASE} | sed '/-----BEGIN PGP SIGNATURE-----/,//d' | tail -n +6) | ||
CHANGELOG=$(git log --no-merges --pretty=format:'- [%h] %s (%aN)' ${PREV_RELEASE}..${RELEASE}) | ||
if [ $? -ne 0 ]; then | ||
echo "Error creating changelog" | ||
exit 1 | ||
fi | ||
|
||
cat <<EOF | ||
${NOTABLE_CHANGES} | ||
|
||
## Installation | ||
|
||
Download Triggermesh Docs ${RELEASE} | ||
|
||
- [container](https://gcr.io/triggermesh/docs:${RELEASE}) | ||
|
||
## Changelog | ||
|
||
${CHANGELOG} | ||
EOF |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this script at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am using it for generating the release notes in the ci job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is: why having release notes for something we update and release continuously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well with this CI in place the docs will (now) be updated at the same time as the monthly release.