Skip to content

Commit

Permalink
Add Golang 1.18 and remove 1.16
Browse files Browse the repository at this point in the history
Also added a note that there is no necessary action to update blobs; our
CI pipeline has a task that will do it automatically.

Signed-off-by: Brian Upton <bupton@vmware.com>
  • Loading branch information
aramprice authored and ystros committed Mar 29, 2022
1 parent 80962d7 commit 6e6b289
Show file tree
Hide file tree
Showing 60 changed files with 187 additions and 197 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,39 @@ To vendor golang package into your release, run:
```
$ git clone https://github.com/bosh-packages/golang-release
$ cd ~/workspace/your-release
$ bosh vendor-package golang-1.17-linux ~/workspace/golang-release
$ bosh vendor-package golang-1.18-linux ~/workspace/golang-release
```

Included packages:

- `golang-1-{linux,darwin,windows}`: updated with latest version of go 1.x
- `golang-1.16-{linux,darwin,windows}`: updated with latest version of go 1.16.x
- `golang-1.17-{linux,darwin,windows}`: updated with latest version of go 1.17.x
- `golang-1.18-{linux,darwin,windows}`: updated with latest version of go 1.18.x

To use `golang-*` package for compilation in your packaging script:

```bash
#!/bin/bash -eu
source /var/vcap/packages/golang-1.17-linux/bosh/compile.env
source /var/vcap/packages/golang-1.18-linux/bosh/compile.env
go build ...
```
or on Windows:

```powershell
. C:\var\vcap\packages\golang-1.17-windows\bosh\compile.ps1
. C:\var\vcap\packages\golang-1.18-windows\bosh\compile.ps1
go build ...
```
[advanced use] To use `golang-*` package at runtime in your job scripts:

```bash
#!/bin/bash -eu
source /var/vcap/packages/golang-1.17-linux/bosh/runtime.env
source /var/vcap/packages/golang-1.18-linux/bosh/runtime.env
go run ...
```
or on Windows:

```powershell
. C:\var\vcap\packages\golang-1.17-windows\bosh\runtime.ps1
. C:\var\vcap\packages\golang-1.18-windows\bosh\runtime.ps1
go run ...
```

Expand All @@ -52,6 +52,8 @@ To run tests `cd tests/ && BOSH_ENVIRONMENT=vbox ./run.sh`
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.

### Windows

You will need to set the following variables, for example:
Expand Down
6 changes: 3 additions & 3 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
- in_parallel:
- get: golang-1.17
trigger: true
- get: golang-1.16
- get: golang-1.18
trigger: true
- get: golang-release
- get: stemcell
Expand Down Expand Up @@ -77,10 +77,10 @@ resources:
access_key_id: ((s3_aws_access_key_id))
secret_access_key: ((s3_aws_secret_access_key))

- name: golang-1.16
- name: golang-1.18
type: dynamic-metalink
source:
version: 1.16.x
version: 1.18.x
version_check: |
curl -s https://go.dev/dl/?mode=json | jq -r '.[].version[2:]'
metalink_get: |
Expand Down
8 changes: 4 additions & 4 deletions ci/tasks/bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ set -x
git config user.name "CI Bot"
git config user.email "cf-bosh-eng@pivotal.io"

replace_if_necessary 1.16 linux
replace_if_necessary 1.16 darwin
replace_if_necessary 1.16 windows
replace_if_necessary 1.18 linux
replace_if_necessary 1.18 darwin
replace_if_necessary 1.18 windows

if [[ "$( git status --porcelain )" != "" ]]; then
git commit -am "Bump to golang $(cat ../golang-1.16/.resource/version)" -m "$(cd ../golang-1.16 && ls)"
git commit -am "Bump to golang $(cat ../golang-1.18/.resource/version)" -m "$(cd ../golang-1.18 && ls)"
fi

replace_if_necessary 1.17 linux true
Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ image_resource:
repository: bosh/main-bosh-docker

inputs:
- name: golang-1.16
- name: golang-1.18
- name: golang-1.17
- name: golang-release
- name: stemcell
Expand Down
12 changes: 0 additions & 12 deletions config/blobs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
go1.16.15.darwin-amd64.tar.gz:
size: 131127000
object_id: 5bb032d2-0cce-4717-497a-46004d157c89
sha: sha256:4f16a427ea513892b7be6646ca26159223d404193ef28c5c45c5f2ec9a0f03d1
go1.16.15.linux-amd64.tar.gz:
size: 129158859
object_id: f365f36c-3844-4d09-4603-468328d7b909
sha: sha256:77c782a633186d78c384f972fb113a43c24be0234c42fef22c2d8c4c4c8e7475
go1.16.15.windows-amd64.zip:
size: 144126817
object_id: 4cd0c89f-0682-4dc7-64d6-da0082ab536f
sha: sha256:0d6e551206b6d744d1286e62abf46aa2f17fed90f07ec4624a0448d71380407d
go1.17.8.darwin-amd64.tar.gz:
size: 136872391
object_id: 98c38da9-8849-4823-74c7-5eaf1e3c15d3
Expand Down
6 changes: 3 additions & 3 deletions dev/add-line
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# Update these variables when adding a new line
old=1.15
last=1.16
new=1.17
old=1.16
last=1.17
new=1.18

# src
cp -fr src/${last}/ src/${new}/
Expand Down
11 changes: 0 additions & 11 deletions jobs/golang-1.16-test-windows/spec

This file was deleted.

13 changes: 0 additions & 13 deletions jobs/golang-1.16-test-windows/templates/run.ps1

This file was deleted.

12 changes: 0 additions & 12 deletions jobs/golang-1.16-test/spec

This file was deleted.

10 changes: 0 additions & 10 deletions jobs/golang-1.16-test/templates/run

This file was deleted.

File renamed without changes.
11 changes: 11 additions & 0 deletions jobs/golang-1.18-test-windows/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: golang-1.18-test-windows

templates:
run.ps1: bin/run.ps1

packages:
- golang-1.18-windows
- golang-1.18-windows-test

properties: {}
13 changes: 13 additions & 0 deletions jobs/golang-1.18-test-windows/templates/run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
try {
Write-Host "Testing compile compatibility"
& "C:\var\vcap\packages\golang-1.18-windows-test\bin\test.exe"

Write-Host "Testing runtime compatibility"
. C:\var\vcap\packages\golang-1.18-windows\bosh\runtime.ps1
go run C:\var\vcap\packages\golang-1.18-windows-test\test.go
} catch {
Write-Host "$_.Exception.Message"
Exit 1
}

Exit 0
File renamed without changes.
12 changes: 12 additions & 0 deletions jobs/golang-1.18-test/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: golang-1.18-test

templates:
run: bin/run

packages:
- golang-1.18-linux
- golang-1.18-linux-test
- golang-1.18-darwin-test

properties: {}
10 changes: 10 additions & 0 deletions jobs/golang-1.18-test/templates/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -eux

echo "Testing compile compability"
/var/vcap/packages/golang-1.18-linux-test/bin/test

echo "Testing runtime compability"
source /var/vcap/packages/golang-1.18-linux/bosh/runtime.env
go run /var/vcap/packages/golang-1.18-linux-test/test.go
4 changes: 2 additions & 2 deletions manifests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ instance_groups:
networks:
- name: default

- name: golang-1.16-test
- name: golang-1.18-test
azs: [z1]
instances: 1
jobs:
- name: golang-1.16-((job-name))
- name: golang-1.18-((job-name))
release: golang
properties: {}
vm_type: default
Expand Down
2 changes: 1 addition & 1 deletion packages/golang-1-darwin/spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ name: golang-1-darwin
files:
- 1/compile.env.darwin
- 1/compile.env.generic
- go1.17*.darwin-amd64.tar.gz
- go1.18*.darwin-amd64.tar.gz
2 changes: 1 addition & 1 deletion packages/golang-1-darwin/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.8
1.18.8
2 changes: 1 addition & 1 deletion packages/golang-1-linux/spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ files:
- 1/runtime.env.linux
- 1/compile.env.linux
- 1/compile.env.generic
- go1.17*.linux-amd64.tar.gz
- go1.18*.linux-amd64.tar.gz
2 changes: 1 addition & 1 deletion packages/golang-1-linux/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.8
1.18.8
2 changes: 1 addition & 1 deletion packages/golang-1-windows/spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ files:
- 1/compile.env.windows
- 1/runtime.env.windows
- exiter.ps1
- go1.17*.windows-amd64.zip
- go1.18*.windows-amd64.zip
2 changes: 1 addition & 1 deletion packages/golang-1-windows/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.8
1.18.8
7 changes: 0 additions & 7 deletions packages/golang-1.16-darwin-test/packaging

This file was deleted.

8 changes: 0 additions & 8 deletions packages/golang-1.16-darwin-test/spec

This file was deleted.

7 changes: 0 additions & 7 deletions packages/golang-1.16-darwin/spec

This file was deleted.

1 change: 0 additions & 1 deletion packages/golang-1.16-darwin/version

This file was deleted.

8 changes: 0 additions & 8 deletions packages/golang-1.16-linux-test/spec

This file was deleted.

10 changes: 0 additions & 10 deletions packages/golang-1.16-linux/packaging

This file was deleted.

8 changes: 0 additions & 8 deletions packages/golang-1.16-linux/spec

This file was deleted.

1 change: 0 additions & 1 deletion packages/golang-1.16-linux/version

This file was deleted.

9 changes: 0 additions & 9 deletions packages/golang-1.16-windows-test/spec

This file was deleted.

8 changes: 0 additions & 8 deletions packages/golang-1.16-windows/spec

This file was deleted.

1 change: 0 additions & 1 deletion packages/golang-1.16-windows/version

This file was deleted.

7 changes: 7 additions & 0 deletions packages/golang-1.18-darwin-test/packaging
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -eux

source /var/vcap/packages/golang-1.18-darwin/bosh/compile.env

which go
8 changes: 8 additions & 0 deletions packages/golang-1.18-darwin-test/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: golang-1.18-darwin-test

dependencies:
- golang-1.18-darwin

files:
- test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ tar xzf go*.darwin-amd64.tar.gz
cp -R go/* ${BOSH_INSTALL_TARGET}

mkdir ${BOSH_INSTALL_TARGET}/bosh
cp 1.16/compile.env.darwin ${BOSH_INSTALL_TARGET}/bosh/compile.env
cp 1.16/compile.env.generic ${BOSH_INSTALL_TARGET}/bosh/compile.env.generic
cp 1.18/compile.env.darwin ${BOSH_INSTALL_TARGET}/bosh/compile.env
cp 1.18/compile.env.generic ${BOSH_INSTALL_TARGET}/bosh/compile.env.generic
7 changes: 7 additions & 0 deletions packages/golang-1.18-darwin/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: golang-1.18-darwin

files:
- 1.18/compile.env.darwin
- 1.18/compile.env.generic
- go1.18*.darwin-amd64.tar.gz
1 change: 1 addition & 0 deletions packages/golang-1.18-darwin/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.18.8
Loading

0 comments on commit 6e6b289

Please sign in to comment.