diff --git a/Jenkinsfile b/Jenkinsfile index 459b0e3..a09d006 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,9 +6,9 @@ pipeline { environment { IMAGE_NAME = 'rd.jenkins' - AWS_URL = "test" //credentials('aws-ecr-url') - AWS_USER = "test" //credentials('aws-ecr-username') - AWS_REGION = "test" //credentials('aws-ecr-region') + AWS_URL = credentials('aws-ecr-url') + AWS_USER = credentials('aws-ecr-username') + AWS_REGION = credentials('aws-ecr-region') AWS_CREDS_ID = 'aws-jenkins' } @@ -42,31 +42,31 @@ pipeline { } } - stage('Build Image') { - steps { - sh "echo ${AWS_IMAGE}" - script { - docker.build("${AWS_IMAGE}", '-f src/worker/Dockerfile ./src/worker/ --no-cache') - // docker.build("${AWS_IMAGE}", '--no-cache --pull -f src/Service/Infrastructure/App/Dockerfile .') - } - } - } - - // stage('AWS ECR Login') { + // stage('Build Image') { // steps { - // withAWS(credentials: AWS_CREDS_ID, region: AWS_REGION) { - // script { - // sh """ - // set -euo pipefail - // echo "Logging in to AWS ECR: \${AWS_URL}" - // aws ecr get-login-password --region "\${AWS_REGION}" \\ - // | docker login --username AWS --password-stdin "\${AWS_URL}" - // """ - // } + // sh "echo ${AWS_IMAGE}" + // script { + // docker.build("${AWS_IMAGE}", '-f src/worker/Dockerfile ./src/worker/ --no-cache') + // // docker.build("${AWS_IMAGE}", '--no-cache --pull -f src/Service/Infrastructure/App/Dockerfile .') // } // } // } + stage('AWS ECR Login') { + steps { + withAWS(credentials: AWS_CREDS_ID, region: AWS_REGION) { + script { + sh """ + set -euo pipefail + echo "Logging in to AWS ECR: \${AWS_URL}" + aws ecr get-login-password --region "\${AWS_REGION}" \\ + | docker login --username AWS --password-stdin "\${AWS_URL}" + """ + } + } + } + } + // stage('Push Image') { // steps { // sh "docker push ${AWS_IMAGE}"