为容器化的 Go 程序搭建 CI
import (
<span style="color: #800000">"<span style="color: #800000">fmt<span style="color: #800000">" <span style="color: #800000">"<span style="color: #800000">net/http<span style="color: #800000">" <span style="color: #800000">"<span style="color: #800000">strings<span style="color: #800000">"<span style="color: #000000"> ) func getNameLen(name <span style="color: #0000ff">string) <span style="color: #0000ff">int<span style="color: #000000"> { func sayHello(w http.ResponseWriter,r *<span style="color: #000000">http.Request) { func main() {
import (
<span style="color: #800000">"<span style="color: #800000">testing<span style="color: #800000">"<span style="color: #000000"> ) func Test_GetNameLen_1(t *<span style="color: #000000">testing.T) { func Test_GetNameLen_2(t *<span style="color: #000000">testing.T) {
golang:1.11.0
CGO_ENABLED=0<span style="color: #008080">FROM<span style="color: #000000"> alpine:latest
<span style="color: #008080">RUN<span style="color: #000000"> apk --no-cache add ca-certificates <span style="color: #008080">WORKDIR<span style="color: #000000"> /root/ <span style="color: #008080">COPY --from=0<span style="color: #000000"> /go/src/gowebdemo . <span style="color: #008080">EXPOSE 8088 <span style="color: #008080">CMD ["./gowebdemo"]
( sh(script: ,returnStatus: ) != = ( currentBuild.result == ,body: gopro build failed
Project: ${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER} URL de build: ${env.BUILD_URL},cc: ,charset : ,: ,mimeType: ,replyTo: ,subject: ${env.JOB_NAME},to: ,body: gopro build success Project: ${env.JOB_NAME} Build Number: ${env.BUILD_NUMBER} URL de build: ${env.BUILD_URL},charset: ,subject: ${env.JOB_NAME},to:
#!/bin/set -<span style="color: #000000">x
go get -d -v golang.org/x/net/<span style="color: #000000">html go get -u github.com/jstemmer/go-junit-<span style="color: #000000">report go test -v <span style="color: #800080">2>&<span style="color: #800080">1 ><span style="color: #000000"> tmp status=$?<span style="color: #000000"> $GOPATH/bin/go-junit-report < tmp ><span style="color: #000000"> test_output.xml exit ${status}
#!/bin/set -<span style="color: #000000">ex
docker build -<span style="color: #000000">t gowebdemo . remove all none tag images<span style="color: #0000ff">if [ ! -z <span style="color: #800000">"<span style="color: #800000">$(docker images -q --filter 'dangling=true')<span style="color: #800000">" ]; <span style="color: #0000ff">then<span style="color: #000000">
#!/bin/set -<span style="color: #000000">ex
remove the current app instance<span style="color: #0000ff">if [ -n <span style="color: #800000">"<span style="color: #800000">$(docker ps -aq -f name=nickwebdemo)<span style="color: #800000">" ]; <span style="color: #0000ff">then<span style="color: #000000"> run a new app instancedocker run -<span style="color: #000000">d
func Test_GetNameLen_3(t * l := getNameLen(); l !=
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |