-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: replace ssh-private-key with ssh-private-keys and expected input is json with array of {name, key} entries. #1
Conversation
…t is json with array if {name, key} entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 1 questions, 1 suggestion (yaml)
ssh-private-keys: | | ||
[ | ||
{ | ||
"name": "[email protected]:vaimo/vsf2_ext-lru-cache-driver.git", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this use yaml instead of text? (i.e. consistent with the rest of the file and validated by the yaml parser, before the action even starts running?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github action doesn't support it. only accepts text as input
from node_modules/@actions/core/lib/core.d.ts
:
/**
* Gets the value of an input.
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
* Returns an empty string if the value is not defined.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
export declare function getInput(name: string, options?: InputOptions): string;
/**
* Gets the values of an multiline input. Each value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string[]
*
*/
export declare function getMultilineInput(name: string, options?: InputOptions): string[];
/**
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
* The return value is also in boolean type.
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns boolean
*/
export declare function getBooleanInput(name: string, options?: InputOptions): boolean;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. The format feels quite verbose to me. Would the follow perhaps be easier/nicer (use repo name as key)?
ssh-private-keys: |
{
"[email protected]:vaimo/vsf2_ext-lru-cache-driver.git": "${{ secrets.TEST_1_DEPLOY_KEY }}",
"[email protected]:mpdude/test-2.git": "${{ secrets.TEST_2_DEPLOY_KEY }}"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will think of that, doesn't hurt to refactor it to that way 👍🏻
name: Hack container for local development | ||
run: | | ||
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - | ||
apt-get install -y nodejs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for, given the next step is "Setup node"? Does that next step not work locally and becomes a "no-op" if nodejs is already installed and at the right version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is "hack" for local container when using with act
tool ( only executed when if: ${{ env.ACT }}
) - got same error as others with node missing. Some "known" issue with the tool when using following combo:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha... so the action to setup node uses node to run :) - how nice.
But yeah, I noticed in an open source project i contributed to that Github's image "ubuntu-latest" is actually different compared to the "ubuntu:latest" and has more things installed already.
Btw, why do you use (overwrite) "ubuntu:latest" as the image and not let act
pick the right image for "ubuntu-latest"? act
has an image ghcr.io/catthehacker/ubuntu:act-latest
- maybe that one contains node
already like github's runner image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems their image does install node: https://github.com/catthehacker/docker_images/blob/master/linux/ubuntu/scripts/act.sh#L128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was taken from parent fork, to test as container. will see if I have possibility to dig more next week
Background
Module https://github.com/webfactory/ssh-agent exports public keys from private keys under
.ssh/
folder and depends only on ssh-agent behaviour on selecting correct cert.When trying to pass to docker build with action which doesn't support forwarded ssh-agent then while trying to use generated key-* files then we get
invalid format
- with PEM or non-PEM / reason is that public key can not be used for ssh-git authentication.Description
With this change we export all passed private keys and use new format for input - Array of {name, key} where
name
should be "[email protected]:owner/repo.git
" and we will use this instead of trying to extract from public key.Example usage