Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeyer42 committed Mar 24, 2021
2 parents 3f24377 + 8812a6b commit 8604a18
Show file tree
Hide file tree
Showing 63 changed files with 5,110 additions and 738 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/ci.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
cmd/godmine/*.exe
cmd/godmine/godmine
.idea/
.code/
target/
out/
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.2.0] - 2021-03-24
### Added
- Add Basic Authentication support for these operations and entities (#3):
- CRUD:
- projects
- issues
- issue categories
- versions
- Read: issue priorities
- Add option to skip SSL certificate verification (#4)
- Under the hood:
- add more meaningful errors for HTTP error responses to aforementioned entities
- add Jenkins CI

### Changed
- Deprecate `NewClient()` constructor in favor of more flexible `ClientBuilder`
- Update Makefiles to support reproducible builds
- Change way of defining the version of the executable

### Removed
- Remove obsolete make targets that rely on a different version definition

## [v0.1.0] - 2021-03-05
### Added
- Add direct project fields (#1)
Expand Down
95 changes: 95 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!groovy
@Library(['github.com/cloudogu/ces-build-lib@1.44.3', 'github.com/cloudogu/dogu-build-lib@v1.2.0', 'github.com/cloudogu/zalenium-build-lib@v2.0.0'])
import com.cloudogu.ces.cesbuildlib.*
import com.cloudogu.ces.dogubuildlib.*
import com.cloudogu.ces.zaleniumbuildlib.*

node('vagrant') {
projectName = 'go-redmine'
project = "github.com/cloudogu/${projectName}"
branch = "${env.BRANCH_NAME}"

timestamps {
stage('Checkout') {
checkout scm
}

new Docker(this)
.image('golang:1.14.13')
.mountJenkinsUser()
.inside("--volume ${WORKSPACE}:/go/src/${project} -w /go/src/${project}")
{

stage('Build') {
make 'clean compile checksum'
archiveArtifacts 'target/*'
}

stage('Unit Test') {
make 'unit-test'
junit allowEmptyResults: true, testResults: 'target/unit-tests/*-tests.xml'
}

stage('Static Analysis') {
def commitSha = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()

withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-gh', usernameVariable: 'USERNAME', passwordVariable: 'REVIEWDOG_GITHUB_API_TOKEN']]) {
withEnv(["CI_PULL_REQUEST=${env.CHANGE_ID}", "CI_COMMIT=${commitSha}", "CI_REPO_OWNER=cloudogu", "CI_REPO_NAME=${projectName}"]) {
make 'static-analysis-ci'
}
}
}
}

stage('SonarQube') {
def scannerHome = tool name: 'sonar-scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
withSonarQubeEnv {
Git git = new Git(this, "cesmarvin")

sh "git config 'remote.origin.fetch' '+refs/heads/*:refs/remotes/origin/*'"
gitWithCredentials("fetch --all")

if (branch == "main") {
echo "This branch has been detected as the master branch."
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${projectName} -Dsonar.projectName=${projectName}"
} else if (branch == "develop") {
echo "This branch has been detected as the develop branch."
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${projectName} -Dsonar.projectName=${projectName} -Dsonar.branch.name=${env.BRANCH_NAME} -Dsonar.branch.target=master "
} else if (env.CHANGE_TARGET) {
echo "This branch has been detected as a pull request."
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${projectName} -Dsonar.projectName=${projectName} -Dsonar.branch.name=${env.CHANGE_BRANCH}-PR${env.CHANGE_ID} -Dsonar.branch.target=${env.CHANGE_TARGET} "
} else if (branch.startsWith("feature/")) {
echo "This branch has been detected as a feature branch."
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${projectName} -Dsonar.projectName=${projectName} -Dsonar.branch.name=${env.BRANCH_NAME} -Dsonar.branch.target=develop"
} else if (branch.startsWith("bugfix/")) {
echo "This branch has been detected as a bugfix branch."
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${projectName} -Dsonar.projectName=${projectName} -Dsonar.branch.name=${env.BRANCH_NAME} -Dsonar.branch.target=develop"
}
}
timeout(time: 2, unit: 'MINUTES') { // Needed when there is no webhook for example
def qGate = waitForQualityGate()
if (qGate.status != 'OK') {
unstable("Pipeline unstable due to SonarQube quality gate failure")
}
}
}

}
}

String project
String projectName
String branch

void make(goal) {
sh "cd /go/src/${project} && make ${goal}"
}

void gitWithCredentials(String command) {
withCredentials([usernamePassword(credentialsId: 'cesmarvin', usernameVariable: 'GIT_AUTH_USR', passwordVariable: 'GIT_AUTH_PSW')]) {
sh(
script: "git -c credential.helper=\"!f() { echo username='\$GIT_AUTH_USR'; echo password='\$GIT_AUTH_PSW'; }; f\" " + command,
returnStdout: true
)
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Cloudogu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 39 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,55 @@
BIN := godmine
VERSION := $$(make -s show-version)
VERSION_PATH := cmd/$(BIN)
ARTIFACT_ID := go-redmine
VERSION := 0.2.0

GOTAG=1.14.13
CUSTOM_GO_MOUNT=-v $(WORKDIR)/resources/compileHeaders/usr/include/btrfs:/usr/include/btrfs
# overwrite ADDITIONAL_LDFLAGS to disable static compilation
# this should fix https://github.com/golang/go/issues/13470
ADDITIONAL_LDFLAGS=""
MAKEFILES_VERSION=4.3.0
.DEFAULT_GOAL:=default

default: compile signature

ADDITIONAL_CLEAN=clean_add
clean_add:
rm -rf $(BIN) goxz

include build/make/variables.mk
PACKAGES_FOR_INTEGRATION_TEST=github.com/cloudogu/cesapp/v2/tasks github.com/cloudogu/cesapp/v2/registry github.com/cloudogu/cesapp/v2/containers

include build/make/info.mk
include build/make/dependencies-gomod.mk
include build/make/build.mk
include build/make/test-common.mk
include build/make/test-unit.mk
include build/make/static-analysis.mk
include build/make/clean.mk
include build/make/digital-signature.mk
include build/make/self-update.mk

BIN=godmine

CURRENT_REVISION := $(shell git rev-parse --short HEAD)
BUILD_LDFLAGS := "-s -w -X main.revision=$(CURRENT_REVISION)"
BUILD_LDFLAGS := "-s -w -X main.Version=$(VERSION)"


GOBIN ?= $(shell go env GOPATH)/bin
export GO111MODULE=on

.PHONY: all
all: build

.PHONY: build
build:
go build -ldflags=$(BUILD_LDFLAGS) -o $(BIN) ./cmd/$(BIN)
all: compile

.PHONY: install
install:
go install -ldflags=$(BUILD_LDFLAGS) ./...

.PHONY: show-version
show-version: $(GOBIN)/gobump
@gobump show -r $(VERSION_PATH)

$(GOBIN)/gobump:
@cd && go get github.com/x-motemen/gobump/cmd/gobump

.PHONY: cross
cross: $(GOBIN)/goxz
goxz -n $(BIN) -pv=v$(VERSION) -build-ldflags=$(BUILD_LDFLAGS) ./cmd/$(BIN)
goxz -n $(ARTIFACT_ID) -pv=v$(VERSION) -build-ldflags=$(BUILD_LDFLAGS) ./cmd/$(BIN)

$(GOBIN)/goxz:
cd && go get github.com/Songmu/goxz/cmd/goxz
go get github.com/Songmu/goxz/cmd/goxz

.PHONY: test
test: build
Expand All @@ -43,29 +63,9 @@ lint: $(GOBIN)/golint
$(GOBIN)/golint:
cd && go get golang.org/x/lint/golint

.PHONY: clean
clean:
rm -rf $(BIN) goxz
go clean

.PHONY: bump
bump: $(GOBIN)/gobump
ifneq ($(shell git status --porcelain),)
$(error git workspace is dirty)
endif
ifneq ($(shell git rev-parse --abbrev-ref HEAD),master)
$(error current branch is not master)
endif
@gobump up -w "$(VERSION_PATH)"
git commit -am "bump up version to $(VERSION)"
git tag "v$(VERSION)"
git push origin master
git push origin "refs/tags/v$(VERSION)"

.PHONY: upload
upload: $(GOBIN)/ghr
ghr "v$(VERSION)" goxz

$(GOBIN)/ghr:
cd && go get github.com/tcnksm/ghr

go get github.com/tcnksm/ghr
Loading

0 comments on commit 8604a18

Please sign in to comment.