chore: update to go 1.19 (#531)
* chore: update to go 1.19 Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com> * chore: bump golangci-lint to v1.48.0 Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com> * chore: remove ioutil and run gofmt Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com> * chore: use 1.19 to pin minor version Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com> Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
This commit is contained in:
Родитель
4956fbf4c7
Коммит
d5ffd3fd59
|
@ -27,7 +27,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.18"
|
||||
go-version: "1.19"
|
||||
- name: Build azwi
|
||||
run: |
|
||||
make bin/azwi
|
||||
|
|
|
@ -32,7 +32,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.18"
|
||||
go-version: "1.19"
|
||||
- name: Install Azure CLI latest
|
||||
run: |
|
||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||
|
@ -106,7 +106,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.18"
|
||||
go-version: "1.19"
|
||||
- name: Build azwi
|
||||
run: |
|
||||
make bin/azwi
|
||||
|
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
ref: "${{ github.event.inputs.based_on_branch }}"
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.18"
|
||||
go-version: "1.19"
|
||||
- run: make release-manifest
|
||||
env:
|
||||
NEW_VERSION: "${{ github.event.inputs.release_version }}"
|
||||
|
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.18"
|
||||
go-version: "1.19"
|
||||
- id: get-tag
|
||||
name: Get tag
|
||||
run: echo "::set-output name=tag::$(echo ${{ github.event.pull_request.head.ref }} | tr -d release-)"
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
run:
|
||||
deadline: 20m
|
||||
# some of the linters don't work correctly with 1.18
|
||||
# xref: https://github.com/golangci/golangci-lint/issues/2649
|
||||
# we are not using generics, so we can pin this to 1.17
|
||||
go: '1.17'
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
|
|
2
Makefile
2
Makefile
|
@ -55,7 +55,7 @@ KUSTOMIZE_VER := v4.1.2
|
|||
KUSTOMIZE_BIN := kustomize
|
||||
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
|
||||
|
||||
GOLANGCI_LINT_VER := v1.46.2
|
||||
GOLANGCI_LINT_VER := v1.48.0
|
||||
GOLANGCI_LINT_BIN := golangci-lint
|
||||
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.18-bullseye
|
||||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.19-bullseye
|
||||
ARG BASEIMAGE=gcr.io/distroless/static:nonroot
|
||||
|
||||
FROM ${BUILDER} as builder
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.18-bullseye
|
||||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.19-bullseye
|
||||
ARG BASEIMAGE=gcr.io/distroless/static:nonroot
|
||||
|
||||
# Build the manager binary
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
1. Prerequisites from [Installation][1]
|
||||
2. Install [go][2]
|
||||
* Get the latest patch version for go 1.18.
|
||||
* Get the latest patch version for go 1.19.
|
||||
3. Install [jq][3]
|
||||
* `brew install jq` on macOS.
|
||||
* `chocolatey install jq` on Windows.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.18-bullseye
|
||||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.19-bullseye
|
||||
ARG BASEIMAGE=gcr.io/distroless/static:nonroot
|
||||
|
||||
FROM ${BUILDER} as builder
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module github.com/Azure/azure-workload-identity/example/msal-go
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go v57.3.0+incompatible
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.18-bullseye
|
||||
ARG BUILDER=mcr.microsoft.com/oss/go/microsoft/golang:1.19-bullseye
|
||||
ARG SERVERCORE_CACHE=gcr.io/k8s-staging-e2e-test-images/windows-servercore-cache:1.0-linux-amd64-${OS_VERSION:-1809}
|
||||
ARG BASEIMAGE=mcr.microsoft.com/windows/nanoserver:${OS_VERSION:-1809}
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/Azure/azure-workload-identity
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/Azure/aad-pod-identity v1.8.11
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
|
@ -120,7 +120,7 @@ func NewAzureClientWithClientSecret(env azure.Environment, subscriptionID, clien
|
|||
|
||||
// NewAzureClientWithClientCertificateFile returns an AzureClient via client_id and jwt certificate assertion
|
||||
func NewAzureClientWithClientCertificateFile(env azure.Environment, subscriptionID, clientID, tenantID, certificatePath, privateKeyPath string) (*AzureClient, error) {
|
||||
certificateData, err := ioutil.ReadFile(certificatePath)
|
||||
certificateData, err := os.ReadFile(certificatePath)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Failed to read certificate")
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ func GetTenantID(resourceManagerEndpoint string, subscriptionID string) (string,
|
|||
}
|
||||
|
||||
func parseRsaPrivateKey(path string) (*rsa.PrivateKey, error) {
|
||||
privateKeyData, err := ioutil.ReadFile(path)
|
||||
privateKeyData, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Run go generate to regenerate this mock.
|
||||
//
|
||||
//go:generate ../../../hack/tools/bin/mockgen -destination cloud_mock.go -package mock_cloud -source ../azureclient.go
|
||||
package mock_cloud //nolint
|
||||
|
|
|
@ -225,10 +225,11 @@ func (dc *detectCmd) run() error {
|
|||
}
|
||||
|
||||
// createServiceAccountFile will create a service account yaml file
|
||||
// 1. If the resource is using default service account, then a new service account yaml is generated
|
||||
// with the resource name as service account name
|
||||
// 2. If the resource is already using a non-default service account, then we modify that service account
|
||||
// to generate the desired yaml file
|
||||
// 1. If the resource is using default service account, then a new service account yaml is generated
|
||||
// with the resource name as service account name
|
||||
// 2. If the resource is already using a non-default service account, then we modify that service account
|
||||
// to generate the desired yaml file
|
||||
//
|
||||
// The service account yaml will contain the workload identity use label ("azure.workload.identity/use: true")
|
||||
// and the client-id annotation ("azure.workload.identity/client-id: <client-id from AzureIdentity>")
|
||||
func (dc *detectCmd) createServiceAccountFile(name, ownerName, clientID string) (*corev1.ServiceAccount, error) {
|
||||
|
@ -280,8 +281,10 @@ func (dc *detectCmd) createServiceAccountFile(name, ownerName, clientID string)
|
|||
}
|
||||
|
||||
// createResourceFile will create a resource yaml file
|
||||
// If the resource is using default service account, then the service account name is updated to the resource name
|
||||
// to match the service account yaml we generated in createServiceAccountFile()
|
||||
//
|
||||
// If the resource is using default service account, then the service account name is updated to the resource name
|
||||
// to match the service account yaml we generated in createServiceAccountFile()
|
||||
//
|
||||
// The resource yaml will contain:
|
||||
// 1. proxy container that is required for migration
|
||||
// 2. proxy-init init container that sets up iptables rules to redirect IMDS traffic to proxy
|
||||
|
|
|
@ -2,7 +2,6 @@ package proxy
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
@ -224,7 +223,7 @@ func TestReadJWTFromFS(t *testing.T) {
|
|||
name: "valid token",
|
||||
writeFile: func() string {
|
||||
tokenFilePath := filepath.Join(os.TempDir(), "test-token")
|
||||
if err := ioutil.WriteFile(tokenFilePath, []byte("token"), 0600); err != nil {
|
||||
if err := os.WriteFile(tokenFilePath, []byte("token"), 0600); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
return tokenFilePath
|
||||
|
|
|
@ -303,9 +303,9 @@ func getSkipContainers(pod *corev1.Pod) map[string]struct{} {
|
|||
|
||||
// getServiceAccountTokenExpiration returns the expiration seconds for the project service account token volume
|
||||
// Order of preference:
|
||||
// 1. annotation in the pod
|
||||
// 2. annotation in the service account
|
||||
// default expiration if no annotation specified
|
||||
// 1. annotation in the pod
|
||||
// 2. annotation in the service account
|
||||
// default expiration if no annotation specified
|
||||
func getServiceAccountTokenExpiration(pod *corev1.Pod, sa *corev1.ServiceAccount) (int64, error) {
|
||||
serviceAccountTokenExpiration := DefaultServiceAccountTokenExpiration
|
||||
var err error
|
||||
|
|
Загрузка…
Ссылка в новой задаче