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

add option to skip dependency installation #77

Closed

Conversation

seemethere
Copy link
Contributor

@seemethere seemethere commented Apr 14, 2021

apt-get is not available on certain distributions so it's better to have
the option to leave it out so we can still have the ability to run this
action without having to be on ubuntu.

Indirectly helps resolve #54

apt-get is not available on certain distributions so it's better to have
the option to leave it out so we can still have the ability to run this
action without having to be on ubuntu.

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Copy link
Collaborator

@dscho dscho left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I have only minor nits, the overall patch looks good to me.

Just one more thing: could we maybe detect whether apt-get is present, and if it isn't, just skip that step?

@@ -54,7 +54,7 @@ describe('Tmate GitHub integration', () => {
Object.defineProperty(process, "platform", {
value: "linux"
})
core.getInput.mockReturnValue("false")
core.getInput.mockReturnValueOnce("false").mockReturnValueOnce("true").mockReturnValue("false")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need two additional mocked return values? From looking at the code, I would have expected only one additional one, just like in the hunk above.

@@ -63,6 +63,19 @@ describe('Tmate GitHub integration', () => {
expect(core.info).toHaveBeenNthCalledWith(2, `SSH: ${customConnectionString}`);
expect(core.info).toHaveBeenNthCalledWith(3, "Exiting debugging session because the continue file was created");
});
it('should be handle the main loop for linux without installing dependencies', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have troubles parsing this description. Could you rephrase this?

Object.defineProperty(process, "platform", {
value: "linux"
})
core.getInput.mockReturnValue("false")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need only one mocked return value here? I would have expected more...

default: 'false'
Copy link
Owner

Choose a reason for hiding this comment

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

would be cool if you could revert the line-ending change from this file so the diff is clean.

await execShellCommand(optionalSudoPrefix + 'apt-get install -y openssh-client xz-utils');

if (core.getInput('install_dependencies') === "true") {
await installDependenciesLinux(optionalSudoPrefix);
Copy link
Owner

Choose a reason for hiding this comment

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

There is now "duplicate code" which confuses me a little bit between the default parameter in the installDependenciesLinux function and the optionalSudoPrefix variable.

I think passing a boolean into the function if its sudo or passing the prefix directly into the function would be cleaner.

Copy link
Collaborator

@dscho dscho Apr 23, 2021

Choose a reason for hiding this comment

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

Additionally, why even bother refactoring this into a separate function? Instead, the else could be turned into else if (core.getInput("install-dependencies") === "true"). Please note that I implicitly also addressed two more issues for consistency:

  • we already use kebap-case in the action, not snake case (i.e. - instead of _ in the input name)
  • we seem to use double quotes rather consistently, not single quotes.

@@ -116,4 +121,4 @@ function didTmateQuit() {
function continueFileExists() {
const continuePath = process.platform === "win32" ? "C:/msys64/continue" : "/continue"
return fs.existsSync(continuePath) || fs.existsSync(path.join(process.env.GITHUB_WORKSPACE, "continue"))
}
Copy link
Owner

Choose a reason for hiding this comment

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

same: revert the line-ending change please.

@mxschmitt
Copy link
Owner

mxschmitt commented Jul 26, 2021

@seemethere are you interested in continuing this Pull Request? otherwise we would close it, thanks!

@mxschmitt mxschmitt closed this Jul 26, 2021
@mxschmitt mxschmitt reopened this Jul 26, 2021
@seemethere
Copy link
Contributor Author

I think we can close this! I ended up approaching this problem from a different angle and no longer need this PR

@seemethere seemethere closed this Jul 26, 2021
noymer pushed a commit to noymer/action-tmate that referenced this pull request Nov 2, 2021
noymer pushed a commit to noymer/action-tmate that referenced this pull request Nov 2, 2021
noymer pushed a commit to noymer/action-tmate that referenced this pull request Nov 2, 2021
dscho added a commit that referenced this pull request Jan 4, 2022
add option to skip dependency installation [#77 reopen]
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.

Support RHEL/CentOS and Fedora containers
3 participants