microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.47k stars 2.6k forks source link

Multiple known_hosts #10838

Closed ghost closed 4 years ago

ghost commented 5 years ago

@AnticliMaxtic commented on Jun 1, 2019, 4:01 PM UTC:

It does not seem to be possible to use a known_hosts file rather than a string for a single known hosts. I have multiple servers that I need the same ssh key to authenticate against and I have put them all in together as one string, but that does not seem to work. I can only access the first one in the list


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

This issue was moved by davidstaheli from MicrosoftDocs/vsts-docs#4411.

ghost commented 5 years ago

@yahalawa commented on Jun 11, 2019, 8:57 PM UTC:

any update on this?

ghost commented 5 years ago

@davidstaheli commented on Jul 5, 2019, 3:22 PM UTC:

yahalawa thanks for asking about this. We're going to move this issue to this repo: https://github.com/Microsoft/azure-pipelines-tasks

/move to Microsoft/azure-pipelines-tasks

berney commented 5 years ago

Does a yaml multiline string help?

yahalawa commented 5 years ago

@berney no it does not i tried that

natebunton commented 5 years ago

Any update on this?

natebunton commented 5 years ago

I was able to work around this by using powershell task after the InstallSSHKey task to add-content to the ~.ssh\known_hosts file:

`

`

tylersouthard commented 4 years ago

I ran into this as well. The workaround works OK, but it's dicey to do on Windows when the agent is running as the Network Service user...

The task really needs to support multiple known host entries.

AnticliMaxtic commented 4 years ago

@Microsoft Any progress on this issue?

@natebunton, your solution has un-stuck us, but a cleaner solution is still desirable

SamYuan1990 commented 4 years ago

Some update here.

I want to start a docker container, as myContainer with port 8080 exported. Then starts test code as curl myContainer:8080

The container doesn't have ssh support, so ... what I excepted is that on /etc/hosts having myContainer 127.0.0.1

So that can avoid myContainer, host not found

ekaterina-tatanova commented 4 years ago

Hello, @AnticliMaxtic, @yahalawa, @berney, @natebunton, @tylersouthard! Using txf-cli, upload the patch from attachments. To do that use these instructions. Upload command example: tfx build tasks upload -u https://<YOUR_ORGANISATION>.visualstudio.com/DefaultCollection -t <YOUR_PERSONAL_ACCESS_TOKEN> --task-path <PATH_TO_TASK> Then replace the task in .yaml file to InstallSSHKeyMultilineHostEntryV0. Please, let us know if it works for you or if you have any questions. Hopefully, I will fix it in the next release.

SamYuan1990 commented 4 years ago

So I am now able to use in azure-pipeline? or is there any sample to use it?

myContainer 127.0.0.1
ekaterina-tatanova commented 4 years ago

@SamYuan1990 The changes are not depoyed yet. If it's necessary to use it now, you may deploy the changed task to your organization like it's described in the comment above.

fluffy-cakes commented 4 years ago

@ekaterina-tatanova , I can see you have merged the changes in. do you know an eta for when that would be generally available to use?

ekaterina-tatanova commented 4 years ago

@fluffy-cakes Hopefully by the end of the next week.

SamYuan1990 commented 4 years ago

@SamYuan1990 The changes are not depoyed yet. If it's necessary to use it now, you may deploy the changed task to your organization like it's described in the comment above.

ok, pls let me know once it ready.

ekaterina-tatanova commented 4 years ago

@fluffy-cakes @SamYuan1990 The changes will be available in 2-3 weeks.

ekaterina-tatanova commented 4 years ago

@fluffy-cakes @SamYuan1990 The changes were deployed in the latest release.

fluffy-cakes commented 4 years ago

@ekaterina-tatanova Can you please advise how to use this new version? InstallSSHKey@0 was the old non-working task, and updating to InstallSSHKey@1 makes no difference.

Comparing a run from last month, I can see no difference in the version of the task being updated, and still won't function as intended.

From

Pool: backupAgents
Agent: vmss-prov-uks-e4c8ba-azdo-e1c7000003
Started: 30 Jun at 10:45
Duration: 28s

2 queue time variables used
Parent pipeline used these runtime parameters
1 artifact produced
Starting: InstallSSHKey
==============================================================================
Task         : Install SSH key
Description  : Install an SSH key prior to a build or deployment
Version      : 0.171.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/install-ssh-key
==============================================================================
Identity added: /vsts/_work/_temp/namingstd (Paul@)
/usr/bin/ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-BTiOHwjZtx3W/agent.114126; export SSH_AUTH_SOCK;
SSH_AGENT_PID=114127; export SSH_AGENT_PID;
echo Agent pid 114127;
/usr/bin/ssh-add -L
The agent has no identities.
/usr/bin/ssh-add /vsts/_work/_temp/namingstd
/usr/bin/ssh-add
Finishing: InstallSSHKey

Going back mid June and earlier, I can see some jobs running v0.170.1. However the issue of not being able to identify and check out two repos from GitHub doesn't work. Perhaps it is me that's doing it wrong, but can you please identify what the version was before, and what it should be now.

ekaterina-tatanova commented 4 years ago

@fluffy-cakes Do you store known_hosts input as variable? Could you please share your yaml file?

SamYuan1990 commented 4 years ago

can someone update here: https://docs.microsoft.com/zh-cn/azure/devops/pipelines/migrate/from-travis?view=azure-devops can't find out sample for how to use it.

image

fluffy-cakes commented 4 years ago

@fluffy-cakes Do you store known_hosts input as variable? Could you please share your yaml file?

@ekaterina-tatanova Since this ticket was closed, I raised another; https://github.com/microsoft/azure-pipelines-tasks/issues/13283

Hopefully you have all the details you need in there.

keithatisoplexis commented 1 year ago

@ekaterina-tatanova There is still no documentation of InstallSSHKeyMultilineHostEntryV0 anywhere. Did this task type get removed?