Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy via ssh #62

Merged
merged 10 commits into from Jan 22, 2022
Merged

Deploy via ssh #62

merged 10 commits into from Jan 22, 2022

Conversation

jezek
Copy link
Contributor

@jezek jezek commented Jan 18, 2022

This PR adds the ability to deploy via ssh.

I've splitted the PR into thematic commits for easier review.

  • The first 6 commits (28a4ea0, ..., 7e1fd88) are refactoring changes, which moves all the adb commands in crossbuilder script into functions with a concrete goal (exec_device, push_device, ...), one adb type per commit.
  • The 7th commit (9eddcb7) refactors the options parameter evaluation before the first adb command call (missing packages checks), to be able to not use adb if --ssh option is passed.
  • The 8th commit (f27805e) is the actual ssh code logic.
  • The last 2 commits (6c1dd34, 4ea693c) are documentation updates and a fix to be able to use --ssh with --no-deb option.

Note: This solves #42 and #14 and renders some changes as unnecessary in PR #53.

@mardy
Copy link
Member

mardy commented Jan 20, 2022

Thanks, this looks excellent! Just please give me a couple of days to try it :-)

We might want to redo a bit the logic, I'd like to have a function device that takes the action as first parameter (and all other action-specific parameters after that), which takes care of invoking the right backend. Something like this:

# Somewhere near the beginning, after parsing the command-line parameters:
if [ ! -z "$SSH_ADDRESS" ] ; then
    DEVICE_BACKEND=ssh
else
    DEVICE_BACKEND=adb
fi

device () {
    ACTION="$1"
    shift
    ${DEVICE_BACKEND}_${ACTION} "$@"
}

which will be used like this:

device push $DEBS_TARBALL /tmp/repo/

so we will need to have for each action a couple of functions like:

ssh_push () {
    local last="${!#}"
    local argv=( "${@:1:$#-1}" )
    scp ${argv[@]} "$SSH_ADDRESS:$last"
}

adb_push () {
    adb push "$@"
}

What do you think? In any case, it's something that we can do after merging this.

@mardy
Copy link
Member

mardy commented Jan 22, 2022

I didn't try the new SSH backend, but the adb one works like a charm, so let's merge this. Thanks again!

@mardy mardy merged commit 9122680 into ubports:master Jan 22, 2022
@jezek jezek deleted the ssh branch January 22, 2022 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants