Repo-Swap and Build
parent
6e5243f405
commit
060bfbd89a
|
@ -0,0 +1,5 @@
|
||||||
|
*
|
||||||
|
!go.mod
|
||||||
|
!go.sum
|
||||||
|
!cmd
|
||||||
|
!pkg
|
|
@ -0,0 +1,3 @@
|
||||||
|
woodpecker-plugin-sonar
|
||||||
|
plugin-sonar
|
||||||
|
.scannerwork
|
|
@ -0,0 +1,50 @@
|
||||||
|
pipeline:
|
||||||
|
debug:
|
||||||
|
image: busybox
|
||||||
|
commands:
|
||||||
|
- env
|
||||||
|
sonar-tests:
|
||||||
|
image: git.kle.li/woodpecker/plugin-sonar:manual
|
||||||
|
settings:
|
||||||
|
sonar_url: https://sonar.kle.li
|
||||||
|
sonar_token:
|
||||||
|
from_secret: sonar_token
|
||||||
|
sonar_key: ${CI_REPO_OWNER}:${CI_REPO_NAME}
|
||||||
|
sonar_quality_enabled: true
|
||||||
|
branchanalysis: auto
|
||||||
|
|
||||||
|
publish-docker-image:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
repo: git.kle.li/${CI_REPO}
|
||||||
|
platforms: linux/amd64
|
||||||
|
tag: ${CI_COMMIT_BRANCH}
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
registry: git.kle.li
|
||||||
|
username:
|
||||||
|
from_secret: gitea_user
|
||||||
|
password:
|
||||||
|
from_secret: gitea_token
|
||||||
|
when:
|
||||||
|
branch: [main, test, dev, release/*]
|
||||||
|
path:
|
||||||
|
exclude: ["*.md", "docs/**"]
|
||||||
|
ignore_message: "[FORCE CI]"
|
||||||
|
|
||||||
|
publish-docker-tag-image:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
repo: git.kle.li/${CI_REPO}
|
||||||
|
platforms: linux/amd64
|
||||||
|
tag: ${CI_COMMIT_TAG},
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
registry: git.kle.li
|
||||||
|
username:
|
||||||
|
from_secret: gitea_user
|
||||||
|
password:
|
||||||
|
from_secret: gitea_token
|
||||||
|
when:
|
||||||
|
tag: v*
|
||||||
|
path:
|
||||||
|
exclude: ["*.md", "docs/**"]
|
||||||
|
ignore_message: "[FORCE CI]"
|
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
FROM golang:1.19-alpine as go-build
|
||||||
|
|
||||||
|
ARG GO_WORK="/go/src/git.kle.li/woodpecker/plugin-sonar"
|
||||||
|
RUN mkdir -p "${GO_WORK}"
|
||||||
|
WORKDIR "${GO_WORK}"
|
||||||
|
COPY ./ "${GO_WORK}/"
|
||||||
|
|
||||||
|
RUN go mod download \
|
||||||
|
&& go mod verify \
|
||||||
|
&& go build -o /plugin-sonar ./cmd/main.go
|
||||||
|
|
||||||
|
|
||||||
|
FROM alpine:latest as sonar-prep
|
||||||
|
ARG SONAR_VERSION=4.7.0.2747
|
||||||
|
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
|
||||||
|
ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
|
||||||
|
WORKDIR "/sonar"
|
||||||
|
|
||||||
|
RUN apk add --no-cache --update curl unzip
|
||||||
|
RUN curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/${SONAR_SCANNER_CLI}.zip -so "/sonar/${SONAR_SCANNER_CLI}.zip" \
|
||||||
|
&& unzip "${SONAR_SCANNER_CLI}.zip" \
|
||||||
|
&& rm "${SONAR_SCANNER_CLI}.zip" \
|
||||||
|
&& pwd && ls -la \
|
||||||
|
&& mv "${SONAR_SCANNER}" "/sonar/sonar-scanner" \
|
||||||
|
&& echo "${SONAR_VERSION}" > "/sonar/sonar-scanner/version"
|
||||||
|
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# set / add low change items
|
||||||
|
WORKDIR /bin
|
||||||
|
RUN apk add --no-cache --update nodejs npm && rm -rf /var/cache/apk/*
|
||||||
|
ENV JAVA_HOME=/opt/java/openjdk
|
||||||
|
COPY --from=eclipse-temurin:17-jre-alpine $JAVA_HOME $JAVA_HOME
|
||||||
|
ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
||||||
|
|
||||||
|
# add plugin binary
|
||||||
|
RUN echo "/plugin-sonar $SONAR_SCANNER"
|
||||||
|
COPY --from=go-build "/plugin-sonar" /bin/
|
||||||
|
|
||||||
|
# add sonar download
|
||||||
|
COPY --from=sonar-prep "/sonar" /bin/
|
||||||
|
ENV PATH $PATH:/bin/sonar-scanner/bin
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/bin/plugin-sonar" ]
|
|
@ -20,9 +20,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
plugLib "git.kle.li/gapodo/woodpecker-plugin-lib/urfave"
|
plugLib "git.kle.li/woodpecker/plugin-lib/urfave"
|
||||||
"git.kle.li/gapodo/woodpecker-plugin-sonar/pkg/plugin"
|
"git.kle.li/woodpecker/plugin-sonar/pkg/plugin"
|
||||||
"git.kle.li/gapodo/woodpecker-plugin-sonar/pkg/sonar"
|
"git.kle.li/woodpecker/plugin-sonar/pkg/sonar"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,7 @@ func main() {
|
||||||
Email: "gapodo@geekvoid.net",
|
Email: "gapodo@geekvoid.net",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Copyright: "(c) 2022 Michael Amann",
|
Copyright: "(c) 2022 Woodpecker Authors",
|
||||||
Before: func(ctx *cli.Context) error {
|
Before: func(ctx *cli.Context) error {
|
||||||
fmt.Fprintf(ctx.App.Writer, "Woodpecker-CI SonarQube plugin\n")
|
fmt.Fprintf(ctx.App.Writer, "Woodpecker-CI SonarQube plugin\n")
|
||||||
return nil
|
return nil
|
4
go.mod
4
go.mod
|
@ -1,9 +1,9 @@
|
||||||
module git.kle.li/gapodo/woodpecker-plugin-sonar
|
module git.kle.li/woodpecker/plugin-sonar
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.kle.li/gapodo/woodpecker-plugin-lib v0.0.4
|
git.kle.li/woodpecker/plugin-lib v0.0.5
|
||||||
github.com/pelletier/go-toml v1.9.5
|
github.com/pelletier/go-toml v1.9.5
|
||||||
github.com/urfave/cli/v2 v2.20.3
|
github.com/urfave/cli/v2 v2.20.3
|
||||||
go.uber.org/zap v1.23.0
|
go.uber.org/zap v1.23.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,5 @@
|
||||||
git.kle.li/gapodo/woodpecker-plugin-lib v0.0.4 h1:+N8ZKk7NkpnCb3/nNTJwM8rjGlK1Wzi4uLzN7HY+wZM=
|
git.kle.li/woodpecker/plugin-lib v0.0.5 h1:sZXGK/zRB83YQu75b3zkh47svRwTWKUccV2jER8Sq7U=
|
||||||
git.kle.li/gapodo/woodpecker-plugin-lib v0.0.4/go.mod h1:HcNuDYsML3ZwNi/pYrgpzwEqkV/e+sC2eaPpaLmmBLQ=
|
git.kle.li/woodpecker/plugin-lib v0.0.5/go.mod h1:vzLk04kVG43eMrJjPIvFBE42UuG9QttZIXUm6HB5LUA=
|
||||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
|
|
@ -21,8 +21,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.kle.li/gapodo/woodpecker-plugin-lib/common"
|
"git.kle.li/woodpecker/plugin-lib/common"
|
||||||
"git.kle.li/gapodo/woodpecker-plugin-sonar/pkg/sonar"
|
"git.kle.li/woodpecker/plugin-sonar/pkg/sonar"
|
||||||
"github.com/pelletier/go-toml"
|
"github.com/pelletier/go-toml"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue