Skip to content

Update go to 1.23 #1199

Update go to 1.23

Update go to 1.23 #1199

Workflow file for this run

---
name: ci
on:
pull_request:
push:
branches:
- 'release/**'
jobs:
yamllint:
uses: networkservicemesh/.github/.github/workflows/yamllint.yaml@main
shellcheck:
uses: networkservicemesh/.github/.github/workflows/shellcheck.yaml@main
golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main
exclude-fmt-errorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main
checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main
gke:
environment: GKE
name: Google Kubernetes Engine
runs-on: ubuntu-latest
steps:
- name: Set up /bin permissions
run: |
sudo chmod -R 777 /bin
- name: Checkout deployments
uses: actions/checkout@v4
with:
repository: networkservicemesh/deployments-k8s
path: networkservicemesh/deployments-k8s
- name: Checkout files
uses: actions/checkout@v4
with:
path: ${{ github.repository }}
- name: Set up go
uses: actions/setup-go@v5
with:
go-version: 1.23.3
- uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }}
- name: Install gcloud-sdk
uses: google-github-actions/setup-gcloud@v2
- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/${{ vars.NSM_KUBERNETES_VERSION }}/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
- name: Setup cluster
working-directory: ${{ github.repository }}
run: |
# Get a specific GKE cluster version that matches NSM_KUBERNETES_VERSION
K8S_VERSION=$(echo ${{ vars.NSM_KUBERNETES_VERSION }} | cut -d '.' -f 1,2 | cut -c 2-)
GKE_CLUSTER_VERSION=$(gcloud container get-server-config --zone="$GKE_CLUSTER_ZONE" --format=json \
| jq '.channels[] | select (.channel=="REGULAR") | .validVersions[]' \
| grep -m 1 "$K8S_VERSION" | tr -d '"')
if [ -z "$GKE_CLUSTER_VERSION"]; then
echo "GKE cluster version is not valid: $GKE_CLUSTER_VERSION"
exit 1
fi
gcloud components install gke-gcloud-auth-plugin
gcloud components update
gcloud container clusters create "${GKE_CLUSTER_NAME}" \
--project="${GKE_PROJECT_ID}" \
--machine-type="${GKE_CLUSTER_TYPE}" \
--num-nodes="${GKE_CLUSTER_NUM_NODES}" \
--zone="${GKE_CLUSTER_ZONE}" \
--cluster-version="${GKE_CLUSTER_VERSION}" \
--enable-gvnic -q
echo "Writing config to ${KUBECONFIG}"
gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}"
env:
GKE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }}
GKE_CLUSTER_NAME: gke-${{ github.run_id }}-${{ github.run_number }}
GKE_CLUSTER_ZONE: us-central1-a
GKE_CLUSTER_TYPE: n1-standard-2
GKE_CLUSTER_NUM_NODES: 2
KUBECONFIG: config
USE_GKE_GCLOUD_AUTH_PLUGIN: true
- name: Run integration tests
working-directory: ${{ github.repository }}
run: |
export KUBECONFIG=$(pwd)/config
kubectl version
go test -count 1 -timeout 1h55m -race -v ./... -parallel 4
env:
ARTIFACTS_DIR: logs
USE_GKE_GCLOUD_AUTH_PLUGIN: true
- name: Cleanup
if: ${{ always() }}
working-directory: ${{ github.repository }}
run: |
gcloud container clusters delete "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}" -q
env:
GKE_PROJECT_ID: ${{ secrets.GOOGLE_PROJECT_ID }}
GKE_CLUSTER_NAME: gke-${{ github.run_id }}-${{ github.run_number }}
GKE_CLUSTER_ZONE: us-central1-a
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: logs-${{ github.run_number }}
path: ${{ github.repository }}/logs