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
Added copy to clipboard button to agent launch snippets #7625
Added copy to clipboard button to agent launch snippets #7625
Conversation
Thanks for the pull request! @prathi-mani please add a description of the testing that you've done under the Could you also extend the title and the description so that the automated changelog will tell readers where the new copy button has been added? Please add a proposed changelog entry that follows the guidance included in the pull request template. Please remove the broken link to |
I think it is JENKINS-70503 |
Thanks @MarkEWaite for the comments, I am new to this open source contribution, I have added the descriptions to my best of ability. Thanks in advance for your guidance. |
Thanks very much for the additions! I've made some minor adjustments (use imperative mood for the changelog entry, etc.). |
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.
Thanks very much for the pull request.
When I used the copy button as implemented in this pull request in my development environment without https, the text was not copied to the clipboard on either Firefox or Google Chrome, even from the other pages that implement it (like the script console page). I see the same behavior with my other Jenkins controllers that are not running over https. I hadn't realized that copy to clipboard is only allowed in secure contexts - over an HTTPS connection, not over an HTTP connection. Thanks for teaching me something very useful!
The text is copied in the script console test that I ran with https://weekly.ci.jenkins.io using the script console.
I'll need some more time to configure a controller running on https so that I can test this change. Thanks very much for teaching me something fundamental about the clipboard and HTTPS
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 would probably make sense to move the copy button out of the <pre>
block right next to the text above it.
This proposal aligns with our overall usage of copy buttons.
I configured a copy of the jar file with the changes and found that the clipboard does not include the text for:
The other items on the page copy as expected to the clipboard. There is extra text inserted into the page that mentions I like the suggestion from @NotMyFault that we should look to make the implementation consistent with other copy buttons. |
Hi @MarkEWaite , I have removed the extra text from the file. And as per my understanding the curl command to download the agent.jar and the java command to execute are two different, so I have inserted two copy buttons to differentiate them from one and another. Please let me know if we need to make it a single copy button at the top of the code snippet. |
Thanks very much! I see that the text has been removed. I like the "Click to copy" at the end of each line. I think it makes sense I'm able to copy the echo statement that creates Unfortunately, when I try to copy the |
There's multiple buttons in each case. Are you suggesting to change the behavior to only have one button per block? |
Hmm, that may explain #6698 (comment) |
I wonder if it would be better for users if we made the copy button visible only if we're running over a secure connection. Unfortunately, I don't know how to detect if the connection between the browser and the controller is secure. |
Creates a heading over the region to be copied and create a set of instructions for Unix agents with a different set of instructions for Windows. The `curl.exe` call must be different on Windows due to PowerShell having a `curl` cmdlet that is not compatible with command line `curl.exe`. Passed my interactive testing with a session in a secure connection.
Switched to one button per region in 2b634cd . The implementation now looks very similar to the copy button that is available from the script console after a command has run in the console. Looks like this |
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.
The changes as they are now have passed my interactive testing. I believe they are ready for review by others. They've passed the CI job previously and are expected to pass again.
Once we have a second approval, I believe we are ready to start the countdown clock for the merge.
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.
Thanks!
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. |
On the server side it would be difficult; you would need to check (Unlikely to affect many real users, just a point of confusion when testing locally.) |
See JENKINS-70503.
Testing done
jenkins.war
built from this pull request. Interactive testing requires an HTTPS connection because the browsers only allow the copy to clipboard over HTTPSProposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
Maintainer checklist
Before the changes are marked as
ready-for-merge
:upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).