Replicating repository from Azure DevOps to AWS Codecommit without Azure Credentials

0

This post might be deleted as it's not a question but a solution I wanted to share with AWS team. This blog describes the way to migrate from Azure DevOps to AWS Codecommit https://aws.amazon.com/blogs/devops/use-aws-codecommit-to-mirror-an-azure-devops-repository-using-an-azure-devops-pipeline/

According to the article, you have to pass Azure HTTPS credentials to the pipeline. See section "Creating a pipeline in Azure DevOps". However, the pipeline already has the branch checked out and access to the repository. HTTPS credentials should not be necessary. I was able to test this and validate mirroring without the credentials. The documentation should be updated to show a pipeline like this:

trigger:

  • '*'

pool: vmImage: 'ubuntu-latest'

steps:

  • checkout: self persistCredentials: true fetchDepth: 0

  • task: Bash@3 displayName: 'Install URL Encoding Tool' inputs: targetType: 'inline' script: | sudo apt-get update sudo apt-get install -y gridsite-clients

  • task: Bash@3 displayName: 'Prepare Repository for Mirroring' inputs: targetType: 'inline' script: | git fetch --prune --unshallow git checkout $(Build.SourceBranchName)

  • task: Bash@3 displayName: 'Sync Repository with AWS CodeCommit' inputs: targetType: 'inline' script: | AWS_CODECOMMIT_REPO_URL="https://$(AWS_GIT_USERNAME):$(urlencode ${AWS_GIT_PASSWORD})@$(AWS_REPO_URL)" git remote add aws "${AWS_CODECOMMIT_REPO_URL}" git push --mirror --force aws env: AWS_REPO_URL: $(AWS_REPO_URL) AWS_GIT_USERNAME: $(AWS_GIT_USERNAME) AWS_GIT_PASSWORD: $(AWS_GIT_PASSWORD)

Bhavik
gefragt vor 3 Monaten64 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen