Add tanzu azure integration #714
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 | |
# azure: | |
# environment: AKS | |
# name: Azure Kubernetes Service | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Install azure-cli | |
# uses: azure/CLI@v1 | |
# with: | |
# inlineScript: | | |
# az version | |
# - name: Set up azure permissions | |
# run: | | |
# sudo chmod -R 777 ~/.azure | |
# - name: Set up /bin permissions | |
# run: | | |
# sudo chmod -R 777 /bin | |
# - name: Set up go | |
# uses: actions/setup-go@v5 | |
# with: | |
# go-version: 1.20.5 | |
# - name: Checkout files | |
# uses: actions/checkout@v4 | |
# with: | |
# path: ${{ github.repository }} | |
# - name: Setup AKS cluster | |
# working-directory: ${{ github.repository }} | |
# run: | | |
# az login --service-principal --username ${AZURE_SERVICE_PRINCIPAL} --password ${AZURE_SERVICE_PRINCIPAL_SECRET} --tenant ${AZURE_TENANT} | |
# az aks create \ | |
# --resource-group "$AZURE_RESOURCE_GROUP" \ | |
# --name "$AZURE_CLUSTER_NAME" \ | |
# --node-count 2 \ | |
# --node-vm-size Standard_B2ms \ | |
# --generate-ssh-keys \ | |
# --debug | |
# az aks wait \ | |
# --name "$AZURE_CLUSTER_NAME" \ | |
# --resource-group "$AZURE_RESOURCE_GROUP" \ | |
# --created > /dev/null | |
# az aks get-credentials \ | |
# --name "$AZURE_CLUSTER_NAME" \ | |
# --resource-group "$AZURE_RESOURCE_GROUP" \ | |
# --file "/tmp/config" \ | |
# --overwrite-existing | |
# env: | |
# AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }} | |
# AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} | |
# AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | |
# AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }} | |
# AZURE_RESOURCE_GROUP: nsm-ci | |
# - name: Run tests | |
# working-directory: ${{ github.repository }} | |
# run: | | |
# go test -count 1 -timeout 1h55m -race -v ./... -parallel 4 | |
# env: | |
# KUBECONFIG: /tmp/config | |
# - name: Cleanup AKS cluster | |
# if: ${{ always() }} | |
# working-directory: ${{ github.repository }} | |
# run: | | |
# az aks delete \ | |
# --name "$AZURE_CLUSTER_NAME" \ | |
# --resource-group "$AZURE_RESOURCE_GROUP" \ | |
# --yes | |
# env: | |
# AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }} | |
# AZURE_RESOURCE_GROUP: nsm-ci | |
# - name: Upload logs | |
# uses: actions/upload-artifact@v4 | |
# if: ${{ always() }} | |
# with: | |
# name: logs-${{ github.run_number }} | |
# path: ${{ github.repository }}/logs | |
azure-tanzu: | |
# needs: azure | |
# environment: Azure Tanzu | |
name: Azure Tanzu | |
runs-on: ubuntu-latest | |
env: | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_SERVICE_PRINCIPAL }} | |
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} | |
AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
AZURE_SSH_PUBLIC_KEY_B64: ${{ secrets.AZURE_SSH_PUBLIC_KEY_B64}} | |
AZURE_RESOURCE_GROUP: nsm-ci | |
steps: | |
- name: Checkout files | |
uses: actions/checkout@v4 | |
- name: Install kind | |
uses: engineerd/setup-kind@v0.5.0 | |
with: | |
version: v0.20.0 | |
image: kindest/node:v1.28.0 | |
skipClusterCreation: true | |
- name: Install clusterctl | |
run: | | |
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.2/clusterctl-linux-amd64 -o clusterctl | |
chmod +x ./clusterctl | |
mv ./clusterctl /usr/local/bin/clusterctl | |
clusterctl version | |
- name: Install azure-cli | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az version | |
- name: Set up azure permissions | |
run: | | |
sudo chmod -R 777 ~/.azure | |
- name: Set up /bin permissions | |
run: | | |
sudo chmod -R 777 /bin | |
- name: Set up go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.20.5 | |
- name: Install Tanzu | |
run: | | |
TANZU_VERSION=v0.25.4 | |
TANZU_HOME=$HOME/tanzu | |
curl -Lo tanzu-framework.tar.gz https://github.com/vmware-tanzu/tanzu-framework/releases/download/v0.25.4/tanzu-framework-linux-amd64.tar.gz | |
mkdir $TANZU_HOME | |
tar -xzf tanzu-framework.tar.gz -C ${TANZU_HOME} | |
mv ${TANZU_HOME}/cli/core/${TANZU_VERSION}/tanzu-core-linux_amd64 /usr/local/bin/tanzu | |
chmod +x /usr/local/bin/tanzu | |
tanzu init | |
- name: Setup envs (CI ONLY) | |
run: | | |
tanzu config set env.AZURE_TENANT_ID ${AZURE_TENANT} | |
tanzu config set env.AZURE_CLIENT_ID ${AZURE_CLIENT_ID} | |
tanzu config set env.AZURE_SUBSCRIPTION_ID ${AZURE_SUBSCRIPTION_ID} | |
tanzu config set env.AZURE_SSH_PUBLIC_KEY_B64 ${AZURE_SSH_PUBLIC_KEY_B64} | |
tanzu config set env.AZURE_RESOURCE_GROUP ${AZURE_RESOURCE_GROUP} | |
tanzu config set env.AZURE_CLIENT_SECRET ${AZURE_CLIENT_SECRET} | |
- name: Setup AKS management cluster | |
run: | | |
tanzu management-cluster create -f management-cluster.yaml --yes | |
kubectl config use-context nsm-tanzu-mg-admin@nsm-tanzu-mg | |
- name: Setup AKS worker cluster | |
run: | | |
tanzu cluster create --file worker-cluster.yaml --yes | |
tanzu cluster kubeconfig get nsm-tanzu-worker --admin | |
kubectl config use-context nsm-tanzu-worker-admin@nsm-tanzu-worker | |
- name: Run integration tests | |
run: | | |
go test -run TestRunMemorySuite -count 1 -timeout 1h -race -v -parallel 4 -gotestmd.t 10m | |
- name: Delete NSM tanzu workload cluster | |
if: ${{ always() }} | |
run: | | |
tanzu cluster delete nsm-tanzu-worker --yes | |
- name: Delete NSM tanzu management cluster | |
if: ${{ always() }} | |
run: | | |
tanzu management-cluster delete nsm-tanzu-mg --yes | |
- name: Upload logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: tanzu-logs-${{ github.run_number }} | |
path: ${{ github.repository }}/logs |