{"id":19149958,"url":"https://github.com/andreiavrammsd/go-jenkins-ci","last_synced_at":"2025-07-17T01:33:47.095Z","repository":{"id":92015756,"uuid":"169983549","full_name":"andreiavrammsd/go-jenkins-ci","owner":"andreiavrammsd","description":"Automated setup of continuous integration for Go projects hosted on GitHub with Jenkins and GolangCI-Lint.","archived":false,"fork":false,"pushed_at":"2019-02-20T20:45:39.000Z","size":59,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T11:50:12.383Z","etag":null,"topics":["continuous-integration","github","go","golang","golangci-lint","jenkins"],"latest_commit_sha":null,"homepage":"https://blog.andreiavram.ro/automated-jenkins-golang-setup/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreiavrammsd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-10T13:54:36.000Z","updated_at":"2024-02-22T03:02:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"d20caa0c-ac79-4d4d-ba75-ddc647506190","html_url":"https://github.com/andreiavrammsd/go-jenkins-ci","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreiavrammsd/go-jenkins-ci","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fgo-jenkins-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fgo-jenkins-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fgo-jenkins-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fgo-jenkins-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreiavrammsd","download_url":"https://codeload.github.com/andreiavrammsd/go-jenkins-ci/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fgo-jenkins-ci/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265558608,"owners_count":23787950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["continuous-integration","github","go","golang","golangci-lint","jenkins"],"created_at":"2024-11-09T08:10:13.379Z","updated_at":"2025-07-17T01:33:47.080Z","avatar_url":"https://github.com/andreiavrammsd.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Jenkins CI\n\nAutomated setup of continuous integration for Go projects hosted on GitHub with [Jenkins](https://jenkins.io/) and [GolangCI-Lint](https://github.com/golangci/golangci-lint).\n\n- Runs unit tests and code quality tools\n- Automatically sets up webhooks on GitHub\n- Can also be configured for non Go projects\n\nIncludes:\n- Pull request job template\n- Branch push job template\n- Various [plugins](JENKINS_HOME/plugins.txt) for simple or advanced jobs management\n- Automatic backups to local path or remote repository\n\n## Requirements\n* Tools (see [install script](./setup/requirements.sh)):\n    * make\n    * Docker\n    * Docker compose\n\n* GitHub [personal access token](https://github.com/settings/tokens) with scopes:\n  * repo\n  * write:repo_hook\n\n## Install\n\nFirst, clone/download repository.\n\n#### Manually\n\n* Copy [.env.dist](.env.dist) to .env and fill in each variable.\n\n    `JENKINS_USERNAME` The username you are going to log in with\n\n    `JENKINS_PASSWORD` The password you are going to log in with\n\n    `JENKINS_URL` The URL which you'll use to access Jenkins\n\n    `JENKINS_PORT` The port number Jenkins container will run on\n\n    `GITHUB_USERNAME` The username of your GitHub account\n\n    `GITHUB_ACCESS_TOKEN` The personal access token generated from your GitHub account\n\n    `GO_VERSION` Default version of Go\n\n    `GOLANGCI_LINT_VERSION` Default version of GolangCI-Lint\n\n* Then run:\n```\nsudo make\n```\n\nSee [Makefile](./Makefile) for more options.\n\n#### Interactive\n\n```\n./setup/install.sh\n```\n\n## Add job\n\n* Create a new job with `Copy from` option and search for the [template](JENKINS_HOME/jobs) you need\n* Enable it by unchecking `General -\u003e Disable this project`\n* Configure it (see below)\n* Saving it will create the required webhooks\n\n## Configure\n\n#### Go\n* `Manage Jenkins -\u003e Global Tool Configuration -\u003e Go -\u003e Go installations` (http://jenkinsurl/configureTools/)\n  * Add a new version: `Add installer -\u003e Extract *.zip/*.tar.gz` (similar to default installed version)\n  * Check versions on [Downloads page](https://golang.org/dl/)\n* Use a Go version for a job (from the job Configure page: http://jenkinsurl/job/jobname/configure)\n  * `Build Environment -\u003e Set up Go programming language tools -\u003e Go version`\n* Plugin: [Golang](https://plugins.jenkins.io/golang)\n\n#### GolangCI-Lint\n* `Manage Jenkins -\u003e Configure System -\u003e Global properties -\u003e Environment variables -\u003e GOLANGCI_LINT_VERSION -\u003e Value`\n* Check versions on [Releases page](https://github.com/golangci/golangci-lint/releases)\n* Use in a job (from the job Configure page: http://jenkinsurl/job/jobname/configure)\n  * `Build -\u003e Add build step -\u003e Execute shell: GO111MODULE=on golangci-lint-run`\n  * Before the tool [runs](JENKINS_HOME/tools/golangci-lint/golangci-lint-run) it [installs](JENKINS_HOME/tools/golangci-lint/golangci-lint-install) the configured version (if not already installed)\n  * It uses a [default config](JENKINS_HOME/tools/golangci-lint/.golangci.yml) which can be overwritten by placing a [config file](https://github.com/golangci/golangci-lint#config-file) in the root of your repository\n\n#### go-consistent\n* A tool to check [source code consistency](https://github.com/Quasilyte/go-consistent).\n* Not added by default to job templates, it can be added as an `Execute shell` build step to a job as `go-consistent-run`.\n* If used, it will install the tool automatically and update it on each run (it has no releases for now).\n\n#### Pull request trigger\n* Configured as a build trigger (from the job Configure page: http://jenkinsurl/job/jobname/configure)\n  * `Source Code Management -\u003e Repository URL`\n  * `Build Triggers -\u003e GitHub Pull Request Builder`\n* Global configuration\n  * `Manage Jenkins -\u003e GitHub Pull Request Builder -\u003e GitHub Auth`\n* Security\n  * The [Go GitHub Pull Request job template](JENKINS_HOME/jobs/Go GitHub Pull Request/config.xml) is configured with the `Build every pull request automatically without asking` option which\n  will trigger the job for any user submitting a pull request. Disable it if it's not safe for you.\n    * From the from the job Configure page: `Build Triggers -\u003e GitHub Pull Request Builder -\u003e Advanced -\u003e Build every pull request automatically without asking (Dangerous!).`\n* Result\n  * The build result will be published as a comment on the PR page\n  * This can be disabled from the job Configure page\n    * `Build Triggers -\u003e GitHub Pull Request Builder -\u003e Trigger Setup -\u003e Comment File`\n* Plugin: [GitHub Pull Request Builder](https://plugins.jenkins.io/ghprb)\n\n#### Branch push trigger\n* Configured as a build trigger (from the job Configure page: http://jenkinsurl/job/jobname/configure)\n  * `General -\u003e GitHub project -\u003e Project url (repository url)`\n  * `Source Code Management -\u003e Repository URL`\n  * `Build Triggers -\u003e GitHub hook trigger for GITScm polling`\n  * `Build Triggers -\u003e Poll SCM`\n* Global configuration\n  * `Manage Jenkins -\u003e GitHub -\u003e GitHub Servers`\n* Plugin: [GitHub Pull Request Builder](https://plugins.jenkins.io/github)\n\n#### Workspace cleanup\n* Workspace data (repository used in job) is always deleted after job is finished\n* Configure from the job Configure page: `Post-build Actions -\u003e Delete workspace when build is done`\n* Plugin: [Workspace Cleanup](https://plugins.jenkins.io/ws-cleanup)\n\n#### Authorization (http://jenkinsurl/configureSecurity/)\n* Configure who has access to Jenkins\n  * `Manage Jenkins -\u003e Configure Global Security -\u003e Enable security -\u003e Access Control -\u003e Authorization -\u003e Matrix-based security`\n* Plugin: [Matrix Authorization Strategy](https://plugins.jenkins.io/matrix-auth)\n\n#### Backup\n* To local path\n * `Manage Jenkins -\u003e ThinBackup`\n * Plugin: [Matrix Authorization Strategy](https://plugins.jenkins.io/matrix-auth)\n* To remote repository\n * See [`Backup` job](./JENKINS_HOME/jobs/Backup/config.xml)\n    * Requires an existing GitHub repository\n    * Enable job by unchecking `General -\u003e Disable this project`\n    * Set the repository url: `Source Code Management -\u003e Repository URL` \n    * Set the build schedule: `Build Triggers -\u003e Build periodically -\u003e Schedule` \n    * Customize the process: `Build -\u003e Execute shell` \n    * Configure repository push: `Post-build Actions -\u003e Git Publisher`\n    * The process is simple: every day, some important parts of the environment are pushed to the specified repository.\n\n## Server\n\nThe server you want to run Jenkins on can be automatically configured with basic security options. \n* A machine with a private SSH key file inside is required\n* A non-root user will be created with SSH access based on the provided key\n* Password authentication will be disabled\n* Root user authentication will be disabled\n* Firewall will be set up with Jenkins and SSH ports open\n\nSee [server setup script](./setup/server.sh).\n\n## Development/Testing\n\nTo fully test on localhost you need a tunnel for GitHub to access your machine.\nYou can use tools like [serveo](http://serveo.net/) and [ngrok](https://ngrok.com/). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreiavrammsd%2Fgo-jenkins-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreiavrammsd%2Fgo-jenkins-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreiavrammsd%2Fgo-jenkins-ci/lists"}