Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

rad-ci: Initial commit #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xphoniex
Copy link
Contributor

@xphoniex xphoniex commented Feb 8, 2022

No description provided.

@xphoniex xphoniex force-pushed the dave/add-ci branch 4 times, most recently from 0b24d9c to abd8fbe Compare February 8, 2022 15:48
src/bin/rad-ci.rs Outdated Show resolved Hide resolved
src/bin/rad-ci.rs Outdated Show resolved Hide resolved
help/src/lib.rs Outdated Show resolved Hide resolved
"Couldn't retrieve ssh-agent key #{}",
options.ssh_index
))?;
agent.userauth(&options.ssh_user, identity)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing a key index is kind of weird, can we not pass a key path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theres ssh which supports key path, but instead of using an index, we could do what other programs do, simply iterate over all keys and return error if all fail. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think avoiding key path in favor of ssh-agent is a better option, now that I used it)

Copy link
Contributor Author

@xphoniex xphoniex Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and removed index, instead now we iterate over all keys. (Just like ssh itself does)

Copy link
Contributor

@cloudhead cloudhead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, left some comments and will try it out when I have time.

src/bin/rad-ci.rs Outdated Show resolved Hide resolved
src/bin/rad-ci.rs Outdated Show resolved Hide resolved
src/bin/rad-ci.rs Outdated Show resolved Hide resolved

let mut remote_file = sess
.scp_send(
std::path::Path::new("/etc/concourse-docker-compose.yml"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not in the user's home directory? It's unlikely they can write to /etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, I think we should use /app/radicle/etc, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also problematic, it won't work unless they have a docker install with our docker images.

src/bin/rad-ci.rs Outdated Show resolved Hide resolved
ci/src/lib.rs Outdated Show resolved Hide resolved
@xphoniex xphoniex force-pushed the dave/add-ci branch 5 times, most recently from e1c9771 to 92c6304 Compare February 11, 2022 13:44
@xphoniex
Copy link
Contributor Author

receive-hook needs an .env file to source user/pass and url of concourse server so I added extract-env which uses grep and cut to extract those values from yaml file. Not ideal, but works for now.

use rad_ci::{run, Options, HELP};

fn main() {
rad_terminal::args::run_command::<Options, _>(HELP, "ci", run);
Copy link
Contributor

@cloudhead cloudhead Feb 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string here is prepended to failure messages like this: {string} failed: {error}.

So let's set it to just "Command" if this tool can do multiple things, then it'll show Command failed: {error}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about this? won't be too informative, also as of now, it's only doing install/uninstalls.

ci/receive-hook Outdated Show resolved Hide resolved
ci/receive-hook Outdated Show resolved Hide resolved
ci/receive-hook Outdated Show resolved Hide resolved
ci/src/lib.rs Outdated
receive_hook_content.as_bytes(),
"/app/radicle/hooks/receieve-hook",
0o755,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not going to work, as you don't know how --root was configured on the server. I think it's best to either have a --remote-root flag to specify it, or to let users install this file manually.

@xphoniex
Copy link
Contributor Author

added --root argument which should fix issues with paths, etc.

Signed-off-by: xphoniex <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants