This repository has been archived by the owner on Jul 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #11 from keptn-contrib/release-0.1.0
Release 0.1.0
- Loading branch information
Showing
25 changed files
with
2,115 additions
and
2 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,5 @@ | ||
.vscode/ | ||
.idea/ | ||
docs/ | ||
deploy/ | ||
Dockerfile |
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,8 @@ | ||
.vscode | ||
|
||
.idea/* | ||
# allow shared run configurations | ||
!.idea/runConfigurations/ | ||
|
||
vendor | ||
|
13 changes: 13 additions & 0 deletions
13
.idea/runConfigurations/keptn_prometheus_sli_service__Kube_ContDeploy_.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,118 @@ | ||
dist: xenial | ||
language: bash | ||
services: | ||
- docker | ||
env: | ||
global: | ||
- GO111MODULE=on | ||
before_install: | ||
- export TZ=Europe/Vienna | ||
- IMAGE=keptn/prometheus-sli-service | ||
- REPO_URL="$(git remote get-url --all origin)" | ||
# get the last tag | ||
- GIT_LAST_TAG=$(git describe --tags $(git rev-list --tags) || echo "0.0.0") | ||
- GIT_NUM_COMMITS_SINCE_LAST_TAG=$(git rev-list ${GIT_LAST_TAG}..HEAD --count || echo "trunk") | ||
# get current branch name | ||
- GIT_BRANCH_NAME=$(git branch | grep \* | cut -d ' ' -f2) | ||
- GIT_SHA=$(git rev-parse --short HEAD) | ||
- GIT_BRANCH_AND_COMMIT=$(git describe --exact-match 2> /dev/null || echo "`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\"%h\" -1`") | ||
# find out if we are on a tag (= exact match) | ||
# if not: use tag + number of commit + commit hash | ||
- VERSION="$(cat version | tr -d '[:space:]')" | ||
- DATE="$(date +'%Y%m%d.%H%M')" | ||
- ./writeManifest.sh | ||
- cat MANIFEST | ||
# uncomment certain lines from Dockerfile that are for travis builds only | ||
- sed -i '/#travis-uncomment/s/^#travis-uncomment //g' Dockerfile | ||
jobs: | ||
include: | ||
- stage: codestyle | ||
# Check Codestyle using go fmt | ||
services: [] | ||
language: go | ||
go: | ||
- 1.12.x | ||
# skip install | ||
install: true | ||
script: | ||
- echo "Checking code style..." | ||
- unformatted=$(gofmt -l .) | ||
- | | ||
if [ ! -z "$unformatted" ]; then | ||
echo "Code Style Check failed for the following files: ${unformatted}". | ||
echo "Please run: gofmt -w ." | ||
echo "After that ammend your commit (e.g.: git add ${unformatted} && git commit --amend --no-edit) and force push the changes (git push -f)." | ||
travis_terminate 1 | ||
fi | ||
- stage: tests | ||
# Run tests | ||
services: [] | ||
language: go | ||
go: | ||
- 1.12.x | ||
# cache some go files | ||
cache: | ||
directories: | ||
- $HOME/.cache/go-build | ||
- $HOME/gopath/pkg/mod | ||
addons: | ||
sonarcloud: | ||
organization: "keptn-contrib" | ||
script: | ||
- sonar-scanner | ||
- go build | ||
- go test -race -v ./... | ||
|
||
- stage: feature/bug/hotfix/patch | ||
# build docker images for feature/bug/hotfix/patch branches | ||
if: branch =~ ^feature.*$ OR branch =~ ^bug.*$ OR branch =~ ^hotfix.*$ OR branch =~ ^patch.*$ | ||
script: | ||
- echo $TRAVIS_BUILD_STAGE_NAME | ||
- TYPE="$(echo $TRAVIS_BRANCH | cut -d'/' -f1)" | ||
- NUMBER="$(echo $TRAVIS_BRANCH | cut -d'/' -f2)" | ||
- docker build . -t "${IMAGE}:${GIT_SHA}" | ||
- docker tag "${IMAGE}:${GIT_SHA}" "${IMAGE}:${TYPE}.${NUMBER}.${DATE}" | ||
after_success: | ||
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin | ||
- docker push "${IMAGE}:${GIT_SHA}" | ||
- docker push "${IMAGE}:${TYPE}.${NUMBER}.${DATE}" | ||
|
||
|
||
- stage: develop | ||
# build docker images for develop branch | ||
if: branch = develop AND NOT type = pull_request | ||
script: | ||
- echo $TRAVIS_BUILD_STAGE_NAME | ||
- docker build . -t "${IMAGE}:${GIT_SHA}" | ||
- docker tag "${IMAGE}:${GIT_SHA}" "${IMAGE}:${DATE}" | ||
- docker tag "${IMAGE}:${GIT_SHA}" "${IMAGE}:latest" | ||
after_success: | ||
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin | ||
- docker push "${IMAGE}:${GIT_SHA}" | ||
- docker push "${IMAGE}:${DATE}" | ||
- docker push "${IMAGE}:latest" | ||
|
||
- stage: release-branch | ||
# build docker images for release branches | ||
if: branch =~ ^release.*$ AND NOT type = pull_request | ||
script: | ||
- echo $TRAVIS_BUILD_STAGE_NAME | ||
- docker build . -t "${IMAGE}:${GIT_SHA}" | ||
- docker tag "${IMAGE}:${GIT_SHA}" "${IMAGE}:${VERSION}.${DATE}" | ||
- docker tag "${IMAGE}:${GIT_SHA}" "${IMAGE}:${VERSION}.latest" | ||
after_success: | ||
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin | ||
- docker push "${IMAGE}:${GIT_SHA}" | ||
- docker push "${IMAGE}:${VERSION}.${DATE}" | ||
- docker push "${IMAGE}:${VERSION}.latest" | ||
|
||
- stage: tags | ||
# build docker images for tags | ||
if: tag IS present | ||
script: | ||
- echo $TRAVIS_BUILD_STAGE_NAME | ||
- docker build . -t "${IMAGE}:${VERSION}" | ||
after_success: | ||
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin | ||
- docker push "${IMAGE}:${VERSION}" |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Lines starting with '#' are comments. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in the repo. | ||
# These owners will be the default owners for everything in the repo. | ||
* @christian-kreuzberger-dtx @bacherfl |
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,54 @@ | ||
# from https://skaffold.dev/docs/workflows/debug/ | ||
# Use the offical Golang image to create a build artifact. | ||
# This is based on Debian and sets the GOPATH to /go. | ||
# https://hub.docker.com/_/golang | ||
FROM golang:1.12 as builder | ||
|
||
WORKDIR /go/src/github.com/keptn-contrib/prometheus-sli-service | ||
|
||
ENV GO111MODULE=on | ||
ENV BUILDFLAGS="" | ||
|
||
# Copy `go.mod` for definitions and `go.sum` to invalidate the next layer | ||
# in case of a change in the dependencies | ||
COPY go.mod go.sum ./ | ||
|
||
# download dependencies | ||
RUN go mod download | ||
|
||
ARG debugBuild | ||
|
||
# set buildflags for debug build | ||
RUN if [ ! -z "$debugBuild" ]; then export BUILDFLAGS='-gcflags "all=-N -l"'; fi | ||
|
||
# finally Copy local code to the container image. | ||
COPY . . | ||
|
||
# Build the command inside the container. | ||
# (You may fetch or manage dependencies here, either manually or with a tool like "godep".) | ||
RUN CGO_ENABLED=0 GOOS=linux go build $BUILDFLAGS -v -o prometheus-sli-service | ||
|
||
# Use a Docker multi-stage build to create a lean production image. | ||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds | ||
FROM alpine:3.7 | ||
RUN apk add --no-cache ca-certificates | ||
|
||
ARG debugBuild | ||
|
||
# IF we are debugging, we need to install libc6-compat for delve to work on alpine based containers | ||
RUN if [ ! -z "$debugBuild" ]; then apk add --no-cache libc6-compat; fi | ||
|
||
# Copy the binary to the production image from the builder stage. | ||
COPY --from=builder /go/src/github.com/keptn-contrib/prometheus-sli-service/prometheus-sli-service /prometheus-sli-service | ||
|
||
EXPOSE 8080 | ||
|
||
# required for external tools to detect this as a go binary | ||
ENV GOTRACEBACK=all | ||
|
||
# KEEP THE FOLLOWING LINES COMMENTED OUT!!! (they will be included within the travis-ci build) | ||
#travis-uncomment ADD MANIFEST / | ||
#travis-uncomment COPY entrypoint.sh / | ||
#travis-uncomment ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
CMD ["/prometheus-sli-service"] |
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,8 @@ | ||
########## | ||
branch: MANIFEST_BRANCH | ||
repository: MANIFEST_REPOSITORY | ||
commitlink: MANIFEST_REPOSITORY/commit/MANIFEST_COMMIT | ||
repolink: MANIFEST_REPOSITORY/tree/MANIFEST_COMMIT | ||
travisbuild: MANIFEST_TRAVIS_JOB_URL | ||
timestamp: MANIFEST_DATE | ||
########## |
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,36 @@ | ||
--- | ||
## prometheus-sli-service sh.keptn.internal.event.get-sli-distributor | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: prometheus-sli-service-monitoring-configure-distributor | ||
namespace: keptn | ||
spec: | ||
selector: | ||
matchLabels: | ||
run: distributor | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
run: distributor | ||
spec: | ||
containers: | ||
- name: distributor | ||
image: keptn/distributor:latest | ||
ports: | ||
- containerPort: 8080 | ||
resources: | ||
requests: | ||
memory: "32Mi" | ||
cpu: "50m" | ||
limits: | ||
memory: "128Mi" | ||
cpu: "500m" | ||
env: | ||
- name: PUBSUB_URL | ||
value: 'nats://keptn-nats-cluster' | ||
- name: PUBSUB_TOPIC | ||
value: 'sh.keptn.internal.event.get-sli' | ||
- name: PUBSUB_RECIPIENT | ||
value: 'prometheus-sli-service' |
Oops, something went wrong.