├── .gitignore
├── Jenkinsfile
├── src
├── main
│ ├── resources
│ │ └── org
│ │ │ └── jenkinsci
│ │ │ └── plugins
│ │ │ └── golang
│ │ │ ├── Messages.properties
│ │ │ ├── GolangBuildWrapper
│ │ │ ├── help.html
│ │ │ └── config.groovy
│ │ │ └── GolangInstaller
│ │ │ └── config.groovy
│ └── java
│ │ └── org
│ │ └── jenkinsci
│ │ └── plugins
│ │ └── golang
│ │ ├── GolangInstallation.java
│ │ ├── GolangBuildWrapper.java
│ │ └── GolangInstaller.java
└── test
│ └── java
│ └── org
│ └── jenkinsci
│ └── plugins
│ └── golang
│ └── GolangInstallerTest.java
├── CHANGELOG.md
├── pom.xml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | target
3 | work
4 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | // Build on ci.jenkins.io; see https://github.com/jenkins-infra/pipeline-library
2 | buildPlugin()
3 |
--------------------------------------------------------------------------------
/src/main/resources/org/jenkinsci/plugins/golang/Messages.properties:
--------------------------------------------------------------------------------
1 | SetUpGoTools=Set up Go programming language tools
2 | InstallFromWebsite=Install from go.dev
3 | InstallingGoOnNode=Unpacking Go from {0} to {1} on {2}
4 | UnrecognisedReleaseId=Go can not be installed, as ''{0}'' is not a known version
5 | CouldNotInstallGo=Could not install Go because {0}
6 | NoInstallerForOs=there is no {0} installer for {1} ({2})...
7 | UnsupportedOs={0} is not a supported OS
8 | UnsupportedCpuArch={0} is not a supported CPU type
9 |
--------------------------------------------------------------------------------
/src/main/resources/org/jenkinsci/plugins/golang/GolangBuildWrapper/help.html:
--------------------------------------------------------------------------------
1 |
2 | Ensures that the selected version of the Go programming language tools are
3 | installed, and that the
GOROOT environment variable points to
4 | that installation during a build.
5 |
6 | In addition, the Go tools (under
$GOROOT/bin) will be added at
7 | the start of the
PATH environment variable during builds.
8 |
9 | If no Go installations have been defined in the Jenkins system config, then
10 | none of the above steps will take place.
11 |
12 |
--------------------------------------------------------------------------------
/src/main/resources/org/jenkinsci/plugins/golang/GolangBuildWrapper/config.groovy:
--------------------------------------------------------------------------------
1 | package org.jenkinsci.plugins.golang;
2 |
3 | def f = namespace(lib.FormTagLib)
4 |
5 | def installationsDefined = descriptor.installations.length != 0
6 | def title = installationsDefined ? _("Go version") :
7 | _("No setup will be done, as no Go installations have been defined in the Jenkins system config")
8 |
9 | f.entry(title: title) {
10 | if (installationsDefined) {
11 | select(class:"setting-input", name:".goVersion") {
12 | descriptor.installations.each {
13 | f.option(selected: it.name == instance?.goInstallation?.name, value: it.name, it.name)
14 | }
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/resources/org/jenkinsci/plugins/golang/GolangInstaller/config.groovy:
--------------------------------------------------------------------------------
1 | package org.jenkinsci.plugins.golang
2 |
3 | def f = namespace(lib.FormTagLib)
4 |
5 | def releases = descriptor.installableReleases
6 | if (releases == null || releases.isEmpty()) {
7 | f.block {
8 | text(_('Go version information has not been downloaded. ' +
9 | 'To do so, press "Check now" in the Plugin Manager, or restart Jenkins.'))
10 | }
11 | } else {
12 | f.entry(title: _("Version"), field: "id") {
13 | select(name: ".id") {
14 | releases.each { release ->
15 | f.option(value: release.id, selected: release.id == instance?.id, release.name)
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Version history
2 |
3 | ## Version 1.4
4 | January 27, 2021
5 |
6 | - Added support for installing Go on machines with 32-bit ARM CPU architecture
7 |
8 | ## Version 1.3
9 | December 20, 2020
10 |
11 | - Added support for installing Go on machines with 64-bit ARM (AArch64) CPU architecture ([#3](https://github.com/jenkinsci/golang-plugin/pull/3); thanks to [Sergei](https://github.com/serges147))
12 | - Increased required Jenkins version to 2.190.3
13 |
14 | ## Version 1.2
15 | February 25, 2017
16 |
17 | - Stopped breaking tool configuration page if the version metadata had not been fetched (see [JENKINS-27499](https://issues.jenkins-ci.org/browse/JENKINS-27499))
18 | - Added `go` symbol, for use with the Pipeline `tool` step (see [JENKINS-34345](https://issues.jenkins-ci.org/browse/JENKINS-34345))
19 | - Increased required Jenkins version to 1.642.3
20 |
21 | ## Version 1.1
22 | June 21, 2014
23 |
24 | - Worked around bug causing newer versions of Go to not install (see [JENKINS-23509](https://issues.jenkins-ci.org/browse/JENKINS-23509))
25 | - Fixed bug where wrong package for OS X could be installed (see [JENKINS-23505](https://issues.jenkins-ci.org/browse/JENKINS-23505))
26 | - Ensured "Install automatically" is checked by default when adding a Go installation
27 |
28 | ## Version 1.0
29 | June 18, 2014
30 |
31 | - Initial release
32 |
--------------------------------------------------------------------------------
/src/main/java/org/jenkinsci/plugins/golang/GolangInstallation.java:
--------------------------------------------------------------------------------
1 | package org.jenkinsci.plugins.golang;
2 |
3 | import hudson.EnvVars;
4 | import hudson.Extension;
5 | import hudson.model.EnvironmentSpecific;
6 | import hudson.model.Node;
7 | import hudson.model.TaskListener;
8 | import hudson.slaves.NodeSpecific;
9 | import hudson.tools.ToolDescriptor;
10 | import hudson.tools.ToolInstallation;
11 | import hudson.tools.ToolInstaller;
12 | import hudson.tools.ToolProperty;
13 | import jenkins.model.Jenkins;
14 | import org.jenkinsci.Symbol;
15 | import org.kohsuke.stapler.DataBoundConstructor;
16 |
17 | import java.io.File;
18 | import java.io.IOException;
19 | import java.util.Collections;
20 | import java.util.List;
21 |
22 | public class GolangInstallation extends ToolInstallation implements EnvironmentSpecific