Update Jenkinsfile
This commit is contained in:
39
Jenkinsfile
vendored
39
Jenkinsfile
vendored
@@ -23,46 +23,53 @@ pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'bufbuild/buf:latest'
|
||||
args '--entrypoint='
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
environment {
|
||||
BUF_CACHE_DIR="${env.WORKSPACE}/.cache"
|
||||
}
|
||||
steps {
|
||||
dir("${env.WORKSPACE}") {
|
||||
echo "Generating Swagger documentation..."
|
||||
sh "buf generate"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Convert OpenAPI to v3') {
|
||||
agent {
|
||||
docker {
|
||||
image 'python:3-bookworm'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir("${env.WORKSPACE}") {
|
||||
sh '''
|
||||
echo "Generating Swagger documentation..."
|
||||
buf generate
|
||||
|
||||
echo "Converting OpenAPI V2 to V3..."
|
||||
python3 scripts/process_openapiv2.py
|
||||
'''
|
||||
sh "python3 scripts/process_openapiv2.py"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
sh '''
|
||||
echo "Building Docker image..."
|
||||
docker build -t ${DOCKER_REGISTRY}/${IMAGE_NAME}:${BUILD_ID} \
|
||||
-f deployments/docker/Dockerfile deployments/docker/
|
||||
'''
|
||||
sh "docker build -t ${DOCKER_REGISTRY}/${IMAGE_NAME}:${BUILD_ID} -f deployments/docker/Dockerfile deployments/docker/"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push Docker Image') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'postio-bot-gitea',
|
||||
credentialsId: 'postio-bot-gitea', // <-- Update to your Jenkins credentials ID
|
||||
usernameVariable: 'DOCKER_USER',
|
||||
passwordVariable: 'DOCKER_PASS'
|
||||
)]) {
|
||||
sh '''
|
||||
echo "Logging into Docker registry..."
|
||||
echo $DOCKER_PASS | docker login ${DOCKER_REGISTRY} -u $DOCKER_USER --password-stdin
|
||||
|
||||
sh "echo $DOCKER_PASS | docker login ${DOCKER_REGISTRY} -u $DOCKER_USER --password-stdin"
|
||||
echo "Pushing Docker image..."
|
||||
docker push ${DOCKER_REGISTRY}/${IMAGE_NAME}:${BUILD_ID}
|
||||
'''
|
||||
sh "docker push ${DOCKER_REGISTRY}/${IMAGE_NAME}:${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user