我有一个简单的 gin gonic 微服务 Golang 项目,我用它来学习如何制作 Jenkins 管道。每个阶段都成功运行,但在管道完成后二进制文件没有运行。还可以通过使用 curl 命中端点来判断进程没有运行:
卷曲http://localhost:9191/users
这是有问题的管道:
pipeline {
agent any
stages {
stage('git') {
steps {
echo "git"
git 'https://github.com/eduFDiaz/golang-microservices.git'
}
}
stage('clean') {
steps {
echo "clean"
sh "make clean"
}
}
stage('test') {
steps {
echo "test"
sh "make test"
}
}
stage('build') {
steps {
echo "build"
sh "make build"
}
}
stage('run') {
steps {
echo "run"
sh "make run"
}
}
}
}
生成文件:
executableName=testApi
clean:
echo "stoping if running and cleaning"
rm -rf ./bin
killall $(executableName) || true
test:
echo "Testing..."
go test -coverprofile cp.out ./mvc/...
go tool cover -html=cp.out
build:
echo "Building..."
go build -o bin/$(executableName) mvc/main.go
run:
echo "Running..."
./bin/$(executableName) &
all: test build run
当我手动完成时,一切都运行良好。我在这里想念什么?
繁星淼淼
相关分类