Note: requires bosh-cli version v2.0.36+ to vendor-package and create-release.
To vendor golang package into your release, run:
$ git clone https://github.com/cloudfoundry/bosh-package-golang-release
$ cd ~/workspace/your-release
$ bosh vendor-package golang-1.26-linux ~/workspace/bosh-package-golang-release
Included packages:
golang-1-{linux,darwin,windows}: updated with latest version of go 1.x
golang-1.25-{linux,darwin,windows}: updated with latest version of go 1.25.x
golang-1.26-{linux,darwin,windows}: updated with latest version of go 1.26.x
To use golang-* package for compilation in your packaging script:
#!/bin/bash -eu
source /var/vcap/packages/golang-1.26-linux/bosh/compile.env
go build ...
or on Windows:
. C:\var\vcap\packages\golang-1.26-windows\bosh\compile.ps1
go build ...
[advanced use] To use golang-* package at runtime in your job scripts:
#!/bin/bash -eu
source /var/vcap/packages/golang-1.26-linux/bosh/runtime.env
go run ...
or on Windows:
. C:\var\vcap\packages\golang-1.26-windows\bosh\runtime.ps1
go run ...
Development
To run tests cd tests/ && BOSH_ENVIRONMENT=vbox ./run.sh
Adding a new golang line
To add a new line, edit the variable in the top of dev/add-line
Execute the script, commit changes, and update the pipeline.
The blobs necessary for the new version line will automatically be added via CI. The build-docker-image job will fail until the blobs are added by the bump job.
Windows
You will need to set the following variables, for example:
This repository provides a couple helpful Concourse tasks in ci/tasks/shared that can help keep the Golang package vendored in your BOSH release up to date, and bump dependencies.
ci/tasks/shared/bump-golang-package
The bump-golang-package task runs bosh vendor-package to automatically update the version of Golang vendored into your own BOSH release.
GIT_USER_NAME: Required. The email that will be used to generate commits.
GIT_USER_EMAIL: Required. The user name that will be used to generate commits.
PACKAGES: Required. Specifies Golang packages will be vendored into your own BOSH release, e.g. the golang-1-linux package.
PACKAGES_TO_REMOVE: Optional. A list of packages to remove from the release. This can be useful if one is bumping from golang-1.x-linux to golang-1.y-linux and 1.y is intended to replace 1.x/
PRIVATE_YML: Required. The contents of config/private.yml for your own BOSH release. Necessary to run bosh vendor-package.
RELEASE_DIR: Required. The directory where your release has been cloned on disk.
ci/tasks/shared/bump-deps
The bump-deps task will update to go version specified in go.mod and then run go get -u ./..., and if a tools package is present go get -u ./tools in the $SOURCE_PATH directory specified.
GIT_USER_NAME: Required. The email that will be used to generate commits.
GIT_USER_EMAIL: Required. The user name that will be used to generate commits.
GO_PACKAGE: Required. The location of the vendored Golang package to be used when running go commands.
SOURCE_PATH: Required. The location of the Golang source you wish to update. Must contain a go.mod file.
golang
Note: requires bosh-cli version
v2.0.36+ tovendor-packageandcreate-release.To vendor golang package into your release, run:
Included packages:
golang-1-{linux,darwin,windows}: updated with latest version of go 1.xgolang-1.25-{linux,darwin,windows}: updated with latest version of go 1.25.xgolang-1.26-{linux,darwin,windows}: updated with latest version of go 1.26.xTo use
golang-*package for compilation in your packaging script:or on Windows:
[advanced use] To use
golang-*package at runtime in your job scripts:or on Windows:
Development
To run tests
cd tests/ && BOSH_ENVIRONMENT=vbox ./run.shAdding a new golang line
To add a new line, edit the variable in the top of
dev/add-lineExecute the script, commit changes, and update the pipeline.The blobs necessary for the new version line will automatically be added via CI. The
build-docker-imagejob will fail until the blobs are added by thebumpjob.Windows
You will need to set the following variables, for example:
Shared Concourse tasks
This repository provides a couple helpful Concourse tasks in
ci/tasks/sharedthat can help keep the Golang package vendored in your BOSH release up to date, and bump dependencies.ci/tasks/shared/bump-golang-package
The
bump-golang-packagetask runsbosh vendor-packageto automatically update the version of Golang vendored into your own BOSH release.GIT_USER_NAME: Required. The email that will be used to generate commits.GIT_USER_EMAIL: Required. The user name that will be used to generate commits.PACKAGES: Required. Specifies Golang packages will be vendored into your own BOSH release, e.g. thegolang-1-linuxpackage.PACKAGES_TO_REMOVE: Optional. A list of packages to remove from the release. This can be useful if one is bumping fromgolang-1.x-linuxtogolang-1.y-linuxand1.yis intended to replace1.x/PRIVATE_YML: Required. The contents of config/private.yml for your own BOSH release. Necessary to runbosh vendor-package.RELEASE_DIR: Required. The directory where your release has been cloned on disk.ci/tasks/shared/bump-deps
The
bump-depstask will update to go version specified ingo.modand then rungo get -u ./..., and if atoolspackage is presentgo get -u ./toolsin the$SOURCE_PATHdirectory specified.GIT_USER_NAME: Required. The email that will be used to generate commits.GIT_USER_EMAIL: Required. The user name that will be used to generate commits.GO_PACKAGE: Required. The location of the vendored Golang package to be used when runninggocommands.SOURCE_PATH: Required. The location of the Golang source you wish to update. Must contain ago.modfile.