Here is the yaml text:
trigger:
- main
resources:
- repo: self
variables:
tag: ‘$(Build.BuildId)’
stages:
Stage 1
Build Docker Image
Publish K8S Files
- stage: Build
displayName: Build image
jobs:-
job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:-
task: Docker@2
inputs:
containerRegistry: ‘sandiipc-docker-hub’
command: ‘logout’ -
task: Docker@2
inputs:
containerRegistry: ‘sandiipc-docker-hub’
command: ‘login’ -
task: Docker@2
inputs:
containerRegistry: ‘sandiipc-docker-hub’
repository: ‘sandiipc/currency-exchange-devops’
command: ‘buildAndPush’
Dockerfile: ‘**/Dockerfile’
tags: ‘$(tag)’ -
task: CopyFiles@2
inputs:
SourceFolder: ‘$(System.DefaultWorkingDirectory)’
Contents: ‘**/*.yaml’
TargetFolder: ‘$(Build.ArtifactStagingDirectory)’ -
task: PublishBuildArtifacts@1
inputs:
PathtoPublish: ‘$(Build.ArtifactStagingDirectory)’
ArtifactName: ‘manifests’
publishLocation: ‘Container’
-
-
Stage 2
Download K8S Files
Deploy to K8s Cluster with Docker Image
- stage: Deploy
displayName: Deploy image
jobs:- job: Build
displayName: Deploy
pool:
vmImage: ubuntu-latest
steps:- task: DownloadPipelineArtifact@2
inputs:
buildType: ‘current’
artifactName: ‘manifests’
itemPattern: ‘**/*.yaml’
targetPath: ‘$(System.ArtifactsDirectory)’ - task: KubernetesManifest@0
inputs:
action: ‘deploy’
kubernetesServiceConnection: ‘azure-kubernetes-connection’
namespace: ‘default’
manifests: ‘$(System.ArtifactsDirectory)/configuration/kubernetes/deployment.yaml’
containers: ‘sandiipc/currency-exchange-devops:$(tag)’
- task: DownloadPipelineArtifact@2
- job: Build
Error message:
Head “https://registry-1.docker.io/v2/library/maven/manifests/3.6.3-jdk-8-slim”: unauthorized: incorrect username or password
Can someone help!!