-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: onboarding files from repo-template-razee
bringing common files in template up to date template: repo-template-razee branch: main commit: 346a51babd6f3322acf3d64763f89a41779c5b2f Ref: REL-91
- Loading branch information
1 parent
3b9a82d
commit b9086dc
Showing
6 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 @@ | ||
* @answerbook/release-engineering |
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,2 @@ | ||
tmp/ | ||
release/ |
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,2 @@ | ||
_last_applied_template_hash: 346a51b | ||
_src_path: /tmp/filesync_clones/repo-template-razee |
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,9 @@ | ||
extends: relaxed | ||
|
||
rules: | ||
empty-lines: | ||
max-end: 3 | ||
indentation: | ||
spaces: consistent | ||
indent-sequences: whatever | ||
line-length: disable |
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,56 @@ | ||
def BRANCH_ACTUAL = env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME | ||
pipeline { | ||
agent { | ||
node { | ||
label 'ec2-fleet' | ||
customWorkspace("/tmp/workspace/${env.BUILD_TAG}") | ||
} | ||
} | ||
|
||
options { | ||
timeout time: 1, unit: 'HOURS' | ||
timestamps() | ||
ansiColor 'xterm' | ||
} | ||
|
||
environment { | ||
GITHUB_TOKEN = credentials('github-api-token') | ||
} | ||
|
||
stages { | ||
stage('Setup') { | ||
steps { | ||
sh "git checkout ${BRANCH_ACTUAL}" | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
sh 'make build' | ||
archiveArtifacts allowEmptyArchive: true, artifacts: 'release/*.yaml', caseSensitive: false, followSymlinks: false | ||
} | ||
} | ||
|
||
stage('Lint') { | ||
steps { | ||
sh 'make lint' | ||
} | ||
} | ||
|
||
stage('Test') { | ||
steps { | ||
sh 'make test' | ||
} | ||
} | ||
|
||
stage('Publish') { | ||
when { | ||
branch 'main' | ||
} | ||
|
||
steps { | ||
sh 'make publish' | ||
} | ||
} | ||
} | ||
} |
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,64 @@ | ||
APP_NAME := $(shell git remote -v | awk '/origin/ && /fetch/ { sub(/\.git/, ""); n=split($$2, origin, "/"); print origin[n]}') | ||
BUILD_DATESTAMP := $(shell date -u '+%Y%m%dT%H%M%SZ') | ||
GIT_BRANCH := $(shell git branch --show-current) | ||
GIT_SHA1 := $(shell git log --pretty=format:'%h' -n 1) | ||
GIT_URL := $(shell git remote get-url origin | sed 's/https:\/\/.*\@github.com/https:\/\/github.com/') | ||
|
||
BUILD_DIR ?= deployment/kubernetes | ||
BUILD_ENV ?= $(TMP_DIR)/build-env | ||
ifndef BUILD_TAG | ||
BUILD_TAG := localbuild://${USER}@$(shell uname -n | sed "s/'//g") | ||
endif | ||
ORG_NAME ?= answerbook | ||
RELEASE_BRANCHES ?= main | ||
RELEASE_DIR ?= release | ||
TMP_DIR ?= tmp | ||
|
||
DOCKER_RUN ?= docker run --rm -i | ||
DOCKER_RUN_BUILD_ENV ?= $(DOCKER_RUN) --env-file=$(BUILD_ENV) | ||
|
||
ENVSUBST_COMMAND ?= $(DOCKER_RUN_BUILD_ENV) -v $(PWD):/data:Z bhgedigital/envsubst envsubst "$$(printf '$${%s} ' $$(cut -f1 -d'=' ${BUILD_ENV}))" | ||
GH_COMMAND ?= $(DOCKER_RUN) -e GITHUB_TOKEN -v $(PWD):/data:Z -w /data us.gcr.io/logdna-k8s/gh:latest gh | ||
KUBEVAL_COMMAND ?= $(DOCKER_RUN) -v $(PWD):/data:Z garethr/kubeval --ignore-missing-schemas | ||
YAMLLINT_COMMAND ?= $(DOCKER_RUN) -v $(PWD):/data:Z cytopia/yamllint:latest | ||
|
||
BUILD_ARTIFACTS := $(wildcard $(BUILD_DIR)/*.yaml.envsubst) | ||
RELEASE_ARTIFACTS := $(patsubst $(BUILD_DIR)/%.envsubst, $(RELEASE_DIR)/%, $(BUILD_ARTIFACTS)) | ||
RELEASE_VERSION := $(BUILD_DATESTAMP) | ||
|
||
include versions.mk | ||
|
||
export | ||
|
||
.PHONY:build clean debug-% lint publish test | ||
|
||
DRAFT = | ||
ifneq ($(GIT_BRANCH), $(filter $(RELEASE_BRANCHES), $(GIT_BRANCH))) | ||
DRAFT = --draft | ||
endif | ||
|
||
$(RELEASE_DIR) $(TMP_DIR): | ||
@mkdir -p $(@) | ||
|
||
$(RELEASE_DIR)/%: $(BUILD_DIR)/%.envsubst $(BUILD_ENV) | $(RELEASE_DIR) | ||
$(ENVSUBST_COMMAND) < $(<) > $(@) | ||
|
||
$(BUILD_ENV): $(TMP_DIR) | ||
@env | awk '!/TOKEN/ && /^(GIT|BUILD|WAVE)/ { print }' | sort > $(@) | ||
|
||
build: $(RELEASE_ARTIFACTS) | ||
|
||
clean: | ||
rm -rf $(RELEASE_DIR) $(TMP_DIR) | ||
|
||
debug-%: ## Debug a variable by calling `make debug-VARIABLE` | ||
@echo $(*) = $($(*)) | ||
|
||
lint: $(RELEASE_ARTIFACTS) | ||
$(YAMLLINT_COMMAND) /data/$(RELEASE_DIR) | ||
|
||
publish: $(RELEASE_ARTIFACTS) | ||
$(GH_COMMAND) release create --repo $(ORG_NAME)/$(APP_NAME) $(DRAFT) $(RELEASE_VERSION) $(RELEASE_ARTIFACTS) | ||
|
||
test: $(RELEASE_ARTIFACTS) | ||
$(KUBEVAL_COMMAND) -d /data/$(RELEASE_DIR) |