fix(jenkinsfile): Fix Docker repo name - use username instead of email
This commit is contained in:
20
apps/demo-nginx/Jenkinsfile
vendored
20
apps/demo-nginx/Jenkinsfile
vendored
@@ -6,9 +6,9 @@ pipeline {
|
||||
APP_NAME = 'demo-nginx'
|
||||
NAMESPACE = 'demo-app'
|
||||
|
||||
// Docker registry (измени на свой registry)
|
||||
DOCKER_REGISTRY = 'docker.io' // Или Harbor: harbor.thedevops.dev
|
||||
DOCKER_REPO = 'vladimir@dbits.lt' // Твой Docker Hub username или Harbor project
|
||||
// Docker registry - ИСПРАВЛЕНО!
|
||||
DOCKER_REGISTRY = 'docker.io'
|
||||
DOCKER_REPO = 'vladimiras' // Твой Docker Hub USERNAME (не email!)
|
||||
|
||||
// Gitea configuration
|
||||
GITEA_URL = 'http://gitea-http.gitea.svc.cluster.local:3000'
|
||||
@@ -24,10 +24,7 @@ pipeline {
|
||||
stage('Checkout Source') {
|
||||
steps {
|
||||
echo "Checking out application source code..."
|
||||
// Если у тебя есть отдельный репозиторий с приложением, клонируй его здесь
|
||||
// git branch: 'main', url: 'http://gitea-http.gitea.svc.cluster.local:3000/admin/demo-nginx-app'
|
||||
|
||||
// Для примера, создадим простой Dockerfile
|
||||
sh '''
|
||||
cat > Dockerfile << 'EOF'
|
||||
FROM nginx:1.25.3-alpine
|
||||
@@ -35,7 +32,7 @@ FROM nginx:1.25.3-alpine
|
||||
# Add custom index.html
|
||||
RUN echo "<html><body><h1>Demo Nginx - Build ${BUILD_NUMBER}</h1><p>Environment: Production</p><p>Version: ${IMAGE_TAG}</p></body></html>" > /usr/share/nginx/html/index.html
|
||||
|
||||
# Add custom nginx config (optional)
|
||||
# Add custom nginx config
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
EXPOSE 80
|
||||
@@ -94,7 +91,6 @@ EOF
|
||||
script {
|
||||
echo "Building Docker image: ${DOCKER_REGISTRY}/${DOCKER_REPO}/${APP_NAME}:${IMAGE_TAG}"
|
||||
|
||||
// Build image
|
||||
sh """
|
||||
docker build \
|
||||
--build-arg BUILD_NUMBER=${BUILD_NUMBER} \
|
||||
@@ -112,7 +108,6 @@ EOF
|
||||
script {
|
||||
echo "Testing Docker image..."
|
||||
|
||||
// Run container for testing
|
||||
sh """
|
||||
docker run -d --name test-${BUILD_NUMBER} \
|
||||
-p 8888:80 \
|
||||
@@ -142,7 +137,6 @@ EOF
|
||||
script {
|
||||
echo "Pushing image to registry..."
|
||||
|
||||
// Login to Docker registry
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'docker-registry-credentials',
|
||||
usernameVariable: 'DOCKER_USER',
|
||||
@@ -278,9 +272,6 @@ EOF
|
||||
|
||||
ArgoCD will automatically sync the changes.
|
||||
"""
|
||||
|
||||
// Optional: Send notification to Slack/Teams/Email
|
||||
// slackSend(color: 'good', message: "Deployment succeeded: ${APP_NAME}:${IMAGE_TAG}")
|
||||
}
|
||||
|
||||
failure {
|
||||
@@ -289,9 +280,6 @@ EOF
|
||||
|
||||
Please check the logs above for details.
|
||||
"""
|
||||
|
||||
// Optional: Send notification
|
||||
// slackSend(color: 'danger', message: "Deployment failed: ${APP_NAME}:${IMAGE_TAG}")
|
||||
}
|
||||
|
||||
always {
|
||||
|
||||
Reference in New Issue
Block a user