Skip to content

Commit

Permalink
feat(jenkins): add jenkins
Browse files Browse the repository at this point in the history
add jenkins

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Apr 19, 2023
1 parent 574214f commit f7acd99
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 41 deletions.
10 changes: 2 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[Makefile]
[{Makefile,*.json}]
indent_style = tab

[*.yml]
[{*.yml,*.yaml}]
indent_style = space

[*.yaml]
indent_style = space

[*.json]
indent_style = tab

41 changes: 22 additions & 19 deletions .gitea/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,26 @@ jobs:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://ghproxy.com/https://github.com/actions/checkout@v3
- name: Setup Go
uses: https://ghproxy.com/https://github.com/actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: install gox
# - name: Checkout
# uses: https://github.com/actions/checkout@v3
# - name: Setup Go
# uses: https://github.com/actions/setup-go@v4
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: install gox
# run: |
# echo "install gox"
# go install github.com/mitchellh/gox@latest
# - name: install upx
# run: |
# echo "install upx"
# sudo apt-get update -qq
# sudo apt-get install -y upx
# - name: Run GoReleaser
# uses: https://github.com/goreleaser/goreleaser-action@v4
# with:
# version: latest
# args: release --rm-dist
- name: example
run: |
echo "install gox"
go install github.com/mitchellh/gox@latest
- name: install upx
run: |
echo "install upx"
sudo apt-get update -qq
sudo apt-get install -y upx
- name: Run GoReleaser
uses: https://ghproxy.com/https://github.com/goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
echo "example gitea"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ patch.diff
hack/manifests/service
*.out
.scannerwork
sonar-project.properties
46 changes: 46 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
pipeline {
agent {
kubernetes {
inheritFrom "code-scan xuanim"
}
}

stages {
stage("checkout code") {
steps {
echo "checkout code success"
}
}

stage('Sonar Scanner') {
parallel {
stage('SonarQube') {
steps {
container('sonar') {
withSonarQubeEnv('sonarqube') {
sh 'make fix-local-version'
sh 'git config --global --add safe.directory $(pwd)'
sh 'sonar-scanner -Dsonar.inclusions=$(git diff --name-only HEAD~1|tr "\\n" ",") -Dsonar.analysis.user=$(git show -s --format=%an)'
}
}
}

post {
success {
container('xuanimbot') {
sh 'git config --global --add safe.directory $(pwd)'
sh '/usr/local/bin/xuanimbot --users "$(git show -s --format=%an)" --title "sonar scanner" --url "https://sonar.qc.oop.cc/dashboard?id=quickon_cli&branch=${GIT_BRANCH}" --content "sonar scanner quickon_cli success" --debug --custom'
}
}
failure {
container('xuanimbot') {
sh 'git config --global --add safe.directory $(pwd)'
sh '/usr/local/bin/xuanimbot --users "$(git show -s --format=%an)" --title "sonar scanner" --url "https://sonar.qc.oop.cc/dashboard?id=quickon_cli&branch=${GIT_BRANCH}" --content "sonar scanner quickon_cli failure" --debug --custom'
}
}
}
}
}
}
}
}
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ snapshot: ## local test goreleaser

fix-version:
@echo "fix version"
cat examples/sonar-project.properties | sed "s#2.0.0#${APP_VERSION}#g" > sonar-project.properties
cat examples/sonar-project.properties.example | sed "s#2.0.0#${APP_VERSION}#g" > sonar-project.properties

fix-local-version:
@echo "fix version"
cat examples/sonar-project.properties.example | sed "s#2.0.0#${APP_VERSION}#g" | sed "s#quickon#pangu#g" > sonar-project.properties
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2
2.0.3
File renamed without changes.
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ require (
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/mem v0.0.0-20220726221520-4f986261bf13 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 // indirect
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.8.0 // indirect
Expand All @@ -217,7 +215,6 @@ require (
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
k8s.io/apiserver v0.26.2 // indirect
k8s.io/component-helpers v0.26.4 // indirect
Expand Down
9 changes: 0 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dvyukov/go-fuzz v0.0.0-20210103155950-6a8e9d1f2415/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/easysoft/quickon-api v0.6.1 h1:Up1KvxUzU64UDUal1/lGHAFX2ei+71rYEOOCaWcrosA=
github.com/easysoft/quickon-api v0.6.1/go.mod h1:J3QfhrkhaitaJzQc16SxiLFOVk86uYhouNaYGHOXzjY=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
Expand Down Expand Up @@ -940,12 +939,8 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 h1:UXLjNohABv4S58tHmeuIZDO6e3mHpW2Dx33gaNt03LE=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29/go.mod h1:cS2ma+47FKrLPdXFpr7CuxiTW3eyJbWew4qx0qtQWDA=
go4.org/mem v0.0.0-20220726221520-4f986261bf13 h1:CbZeCBZ0aZj8EfVgnqQcYZgf0lpZ3H9rmp5nkDTAst8=
go4.org/mem v0.0.0-20220726221520-4f986261bf13/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 h1:Tx9kY6yUkLge/pFG7IEMwDZy6CS2ajFc9TvQdPCW0uA=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down Expand Up @@ -1469,8 +1464,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6 h1:acCzuUSQ79tGsM/O50VRFySfMm19IoMKL+sZztZkCxw=
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6/go.mod h1:y3MGhcFMlh0KZPMuXXow8mpjxxAk3yoDNsp4cQz54i8=
k8s.io/api v0.26.4 h1:qSG2PmtcD23BkYiWfoYAcak870eF/hE7NNYBYavTT94=
k8s.io/api v0.26.4/go.mod h1:WwKEXU3R1rgCZ77AYa7DFksd9/BAIKyOmRlbVxgvjCk=
k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI=
Expand Down Expand Up @@ -1520,7 +1513,5 @@ sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
tailscale.com v1.24.2 h1:xNqEMKLHjqKwKUlggL2QEt1B+oit08w3SwZEIWCmqTg=
tailscale.com v1.24.2/go.mod h1:/z/lF98LSt9CjpwVT6pHh5Vwb1NGsM5/ACI4cLMJfvY=
tailscale.com v1.38.4 h1:ItZfSYhLCnY/fjwlBqdgcf0mjjh2W8eFhUM5XIsSqdE=
tailscale.com v1.38.4/go.mod h1:UWLQxcd8dz+lds2I+HpfXSruHrvXM1j4zd4zdx86t7w=

0 comments on commit f7acd99

Please sign in to comment.