0

I am trying to create a Release pipeline that:

  1. Updates the docker image in the docker-compose.yml that is a part of my deployment repository
  2. Logs via SSH to my server
  3. [On my remote server] fetches the latest deployment repository
  4. [On my remote server] runs the updated docker-compose.yml

I stuck on the point #1. I managed to get to the point where I have my repository available, I update the docker-compose.yml file (via bash script), I can commit the changes but unfortunately the push fails.

Here's my release pipeline with two artifacts:

  1. my build pipeline which I'm using to get the build number that I want to release
  2. my GitHub repository (since I'm using 2FA, I've linked it via Personal Token)

pipeline definition

Here's my stage with three bash scripts - the first two are updating docker-compose.yml, the third one should commit the changes to the repository and push it.

stage definition

Here's the result I'm getting when running the release:

enter image description here

It seems there's some problem with authentication when doing git push, but I'm not sure how to solve this. This SO suggests it's a problem with 2FA enabled on the git side, but since I'm using Personal Access Token to authenticate to git, 2FA should not be used. Even if I add this line to my script as suggested in that SO:

git config --global --add url."git@github.com:".insteadOf "https://github.com/"

It still fails with the following error:

Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Could anyone guide me how to properly push git repository as a part of Azure release pipeline?

xmcax
  • 313
  • 1
  • 8

1 Answers1

2

I found a workaround that seems to solve my problem. I have removed the repository from the artifacts list and instead I'm doing everything manually:

  1. Installing SSH key (via native Install SSH Key task)
  2. Cloning the repository using SSH key (via Bash script)
  3. Executing all the logic
  4. Cleaning up the repository (not sure this is needed, but to be on the safe side...)

stages

xmcax
  • 313
  • 1
  • 8
  • Hi friend, very appreciate for this solution sharing. Please [mark your reply as answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) and that will help other community members who easier search this useful information, it just a reminder :) – Mengdi Liang Nov 27 '19 at 03:33