Skip to content

Commit

Permalink
Merge pull request #1057 from anthonydahanne/fix-1053-upgrade-setup-go
Browse files Browse the repository at this point in the history
Closes #1053: Upgrade setup-go from v3 to v4
  • Loading branch information
dmikusa authored Mar 17, 2023
2 parents ed82d63 + 80e0de1 commit e86a3cf
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pb-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
path: ${{ env.HOME }}/go/pkg/mod
restore-keys: ${{ runner.os }}-go-
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.18"
- name: Install create-package
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
path: ${{ env.HOME }}/go/pkg/mod
restore-keys: ${{ runner.os }}-go-
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.18"
- name: Install richgo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pb-update-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on:
- ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.18"
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pb-update-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on:
- ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.18"
- name: Install octo
Expand Down
7 changes: 3 additions & 4 deletions octo/builder_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package octo

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
Expand All @@ -32,7 +31,7 @@ import (

func ContributeBuilderDependencies(descriptor Descriptor) ([]Contribution, error) {
file := filepath.Join(descriptor.Path, "builder.toml")
b, err := ioutil.ReadFile(file)
b, err := os.ReadFile(file)
if os.IsNotExist(err) {
return nil, nil
} else if err != nil {
Expand Down Expand Up @@ -87,7 +86,7 @@ func contributeBuildImage(descriptor Descriptor, image string, classifier string
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down Expand Up @@ -157,7 +156,7 @@ func contributeLifecycle(descriptor Descriptor) (Contribution, error) {
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
2 changes: 1 addition & 1 deletion octo/buildpack_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func ContributeBuildpackDependencies(descriptor Descriptor) ([]Contribution, err
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
2 changes: 1 addition & 1 deletion octo/create_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func ContributeCreateBuilder(descriptor Descriptor) (*Contribution, error) {
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
6 changes: 3 additions & 3 deletions octo/create_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package octo

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
Expand All @@ -44,7 +44,7 @@ func ContributeCreatePackage(descriptor Descriptor) (*Contribution, error) {
}

file := filepath.Join(descriptor.Path, "buildpack.toml")
s, err := ioutil.ReadFile(file)
s, err := os.ReadFile(file)
if err != nil {
return nil, fmt.Errorf("unable to read %s\n%w", file, err)
}
Expand All @@ -69,7 +69,7 @@ func ContributeCreatePackage(descriptor Descriptor) (*Contribution, error) {
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
2 changes: 1 addition & 1 deletion octo/lite_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func contributeLitePackage(descriptor Descriptor, republishImage RepublishImage)
},
},
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
If: "${{ ! steps.version.outputs.skip }}",
With: map[string]interface{}{"go-version": GoVersion},
},
Expand Down
2 changes: 1 addition & 1 deletion octo/offline_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func contributeOfflinePackage(descriptor Descriptor, offlinePackage OfflinePacka
},
},
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
If: "${{ ! steps.version.outputs.skip }}",
With: map[string]interface{}{"go-version": GoVersion},
},
Expand Down
24 changes: 12 additions & 12 deletions octo/package_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package octo

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
Expand All @@ -35,7 +34,7 @@ func ContributePackageDependencies(descriptor Descriptor) ([]Contribution, error
var contributions []Contribution

file := filepath.Join(descriptor.Path, "package.toml")
b, err := ioutil.ReadFile(file)
b, err := os.ReadFile(file)
if os.IsNotExist(err) {
return nil, nil
} else if err != nil {
Expand All @@ -47,7 +46,7 @@ func ContributePackageDependencies(descriptor Descriptor) ([]Contribution, error
}

file = filepath.Join(descriptor.Path, "buildpack.toml")
b, err = ioutil.ReadFile(file)
b, err = os.ReadFile(file)
if os.IsNotExist(err) {
return nil, nil
} else if err != nil {
Expand Down Expand Up @@ -75,16 +74,17 @@ func ContributePackageDependencies(descriptor Descriptor) ([]Contribution, error
}

// findIds will return the pkg group id (used in package.toml) and the buildpack id (used in buildpack.toml)
// it will do some fuzzy matching because there is not a strict relationship between the two
// - often pkg group id is `repo.io/buildpack/id:version`, so you can extract `buildpack/id`
// - if that does not exist as a build pack id, then we search for just the last part of
// buildpack id and a matching version
//
// for example, `gcr.io/tanzu-buildpacks/bellsoft-liberica:1.2.3`, we'll look for `bellsoft-liberica`
// and version `1.2.3` in buildpack.toml
// it will do some fuzzy matching because there is not a strict relationship between the two
// - often pkg group id is `repo.io/buildpack/id:version`, so you can extract `buildpack/id`
// - if that does not exist as a build pack id, then we search for just the last part of
// buildpack id and a matching version
//
// if there is a match, then we return the found buildpack id, let's say it finds `paketo-buildpacks/bellsoft-liberica`
// then we return `gcr.io/paketo-buildpacks/bellsoft-liberica:1.2.3`
// for example, `gcr.io/tanzu-buildpacks/bellsoft-liberica:1.2.3`, we'll look for `bellsoft-liberica`
// and version `1.2.3` in buildpack.toml
//
// if there is a match, then we return the found buildpack id, let's say it finds `paketo-buildpacks/bellsoft-liberica`
// then we return `gcr.io/paketo-buildpacks/bellsoft-liberica:1.2.3`
func findIds(bpOrders _package.BuildpackOrderGroups, dep _package.Dependency) (string, string, error) {
re := regexp.MustCompile(`^(?:.+://)?(.+?)/(.+):([^:]+)$`)
if g := re.FindStringSubmatch(dep.URI); g == nil {
Expand Down Expand Up @@ -135,7 +135,7 @@ func contributePackageDependency(descriptor Descriptor, name string, bpId string
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
6 changes: 3 additions & 3 deletions octo/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func ContributeTest(descriptor Descriptor) (*Contribution, error) {
},
},
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
},
Expand Down Expand Up @@ -123,7 +123,7 @@ func ContributeTest(descriptor Descriptor) (*Contribution, error) {
},
},
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down Expand Up @@ -201,7 +201,7 @@ func ContributeTest(descriptor Descriptor) (*Contribution, error) {
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
2 changes: 1 addition & 1 deletion octo/update_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ContributeUpdateGo(descriptor Descriptor) (*Contribution, error) {
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down
2 changes: 1 addition & 1 deletion octo/update_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func ContributeUpdatePipeline(descriptor Descriptor) (Contribution, error) {
RunsOn: []actions.VirtualEnvironment{actions.UbuntuLatest},
Steps: []actions.Step{
{
Uses: "actions/setup-go@v3",
Uses: "actions/setup-go@v4",
With: map[string]interface{}{"go-version": GoVersion},
},
{
Expand Down

0 comments on commit e86a3cf

Please sign in to comment.