Bläddra i källkod

CI: bump Go to 1.19

This bumps the version of Golang used in CI to the latest release.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
Lucas Servén Marín 3 år sedan
förälder
incheckning
8854e77ea5
6 ändrade filer med 20 tillägg och 21 borttagningar
  1. 11 11
      .github/workflows/ci.yml
  2. 1 1
      .github/workflows/release.yaml
  3. 1 1
      Makefile
  4. 2 2
      cmd/kg/webhook.go
  5. 3 3
      pkg/mesh/cni.go
  6. 2 3
      pkg/mesh/mesh.go

+ 11 - 11
.github/workflows/ci.yml

@@ -19,7 +19,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Vendor
       run: |
         make vendor
@@ -32,7 +32,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Build
       run: make
 
@@ -43,7 +43,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Build docs
       run: |
         make gen-docs
@@ -56,7 +56,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Build kg and kgctl for all Linux Architectures
       run: make all-build
 
@@ -67,7 +67,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Build kgctl for Darwin amd64
       run: make OS=darwin ARCH=amd64
     - name: Build kgctl for Darwin arm64
@@ -80,7 +80,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Build kgctl for Windows
       run: make OS=windows
 
@@ -91,7 +91,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Run Unit Tests
       run: make unit
 
@@ -102,7 +102,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Run e2e Tests
       run: make e2e
 
@@ -113,7 +113,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Lint Code
       run: make lint
 
@@ -124,7 +124,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Enable Experimental Docker CLI
       run: |
         echo $'{\n  "experimental": true\n}' | sudo tee /etc/docker/daemon.json
@@ -154,7 +154,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Enable Experimental Docker CLI
       run: |
         echo $'{\n  "experimental": true\n}' | sudo tee /etc/docker/daemon.json

+ 1 - 1
.github/workflows/release.yaml

@@ -10,7 +10,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2
       with:
-        go-version: 1.18
+        go-version: 1.19
     - name: Build kgctl Binaries to Be Released
       run: make release
     - name: Publish Release

+ 1 - 1
Makefile

@@ -45,7 +45,7 @@ KUBECTL_BINARY := $(shell pwd)/bin/kubectl
 BASH_UNIT := $(shell pwd)/bin/bash_unit
 BASH_UNIT_FLAGS :=
 
-BUILD_IMAGE ?= golang:1.18.0
+BUILD_IMAGE ?= golang:1.19.0
 BASE_IMAGE ?= alpine:3.15
 
 build: $(BINS)

+ 2 - 2
cmd/kg/webhook.go

@@ -19,7 +19,7 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"os"
 	"syscall"
@@ -92,7 +92,7 @@ var (
 
 func validationHandler(w http.ResponseWriter, r *http.Request) {
 	level.Debug(logger).Log("msg", "handling request", "source", r.RemoteAddr)
-	body, err := ioutil.ReadAll(r.Body)
+	body, err := io.ReadAll(r.Body)
 	if err != nil {
 		errorCounter.Inc()
 		level.Error(logger).Log("err", "failed to parse body from incoming request", "source", r.RemoteAddr)

+ 3 - 3
pkg/mesh/cni.go

@@ -21,8 +21,8 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
-	"io/ioutil"
 	"net"
+	"os"
 
 	"github.com/containernetworking/cni/libcni"
 	"github.com/containernetworking/cni/pkg/types"
@@ -109,7 +109,7 @@ func getCIDRFromCNI(path string) (*net.IPNet, error) {
 
 // setCIDRInCNI sets the CIDR allocated to the node in the CNI configuration file.
 func setCIDRInCNI(path string, cidr *net.IPNet) error {
-	f, err := ioutil.ReadFile(path)
+	f, err := os.ReadFile(path)
 	if err != nil {
 		return fmt.Errorf("failed to read CNI config list file: %v", err)
 	}
@@ -155,7 +155,7 @@ func setCIDRInCNI(path string, cidr *net.IPNet) error {
 	if err != nil {
 		return fmt.Errorf("failed to marshal CNI config: %v", err)
 	}
-	if err := ioutil.WriteFile(path, buf, 0644); err != nil {
+	if err := os.WriteFile(path, buf, 0644); err != nil {
 		return fmt.Errorf("failed to write CNI config file to disk: %v", err)
 	}
 	return nil

+ 2 - 3
pkg/mesh/mesh.go

@@ -21,7 +21,6 @@ import (
 	"bytes"
 	"context"
 	"fmt"
-	"io/ioutil"
 	"net"
 	"os"
 	"sync"
@@ -92,7 +91,7 @@ func New(backend Backend, enc encapsulation.Encapsulator, granularity Granularit
 	if err := os.MkdirAll(kiloPath, 0700); err != nil {
 		return nil, fmt.Errorf("failed to create directory to store configuration: %v", err)
 	}
-	privateB, err := ioutil.ReadFile(privateKeyPath)
+	privateB, err := os.ReadFile(privateKeyPath)
 	if err != nil && !os.IsNotExist(err) {
 		return nil, fmt.Errorf("failed to read private key file: %v", err)
 	}
@@ -108,7 +107,7 @@ func New(backend Backend, enc encapsulation.Encapsulator, granularity Granularit
 	if err != nil {
 		return nil, err
 	}
-	if err := ioutil.WriteFile(privateKeyPath, []byte(private.String()), 0600); err != nil {
+	if err := os.WriteFile(privateKeyPath, []byte(private.String()), 0600); err != nil {
 		return nil, fmt.Errorf("failed to write private key to disk: %v", err)
 	}
 	cniIndex, err := cniDeviceIndex()