Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64 for release builds #400

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 52 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,35 @@ jobs:
checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main

make-matrix:
name: make matrix
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
matrix: ${{ steps.make-matrix.outputs.matrix }}
steps:
- id: make-matrix
run: |
if ${{ startsWith(github.ref_name, 'release/') }}; then
echo "matrix={\"config\":[ \
{\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"default\"}, \
{\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"calico-vpp\"}, \
{\"node_type\":\"c3.large.arm64\",\"CNI\":\"default\"} \
]}" >> $GITHUB_OUTPUT
else
echo "matrix={\"config\":[ \
{\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"default\"}, \
{\"node_type\":\"n3.xlarge.x86\",\"CNI\":\"calico-vpp\"} \
]}" >> $GITHUB_OUTPUT
fi

packet:
name: packet (CNI ${{ matrix.CNI }})
name: ${{ matrix.config.node_type }} (CNI ${{ matrix.config.CNI }})
runs-on: ubuntu-latest
needs: make-matrix
strategy:
fail-fast: false
matrix:
CNI: ["default", "calico-vpp"]
matrix: ${{ fromJSON(needs.make-matrix.outputs.matrix) }}
steps:
- name: Set up /bin permissions
run: |
Expand All @@ -47,20 +69,31 @@ jobs:

- name: Set envs
run: |
id=${{ matrix.CNI }}-${{ github.run_number }}
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then
id=calico-${{ github.run_number }}
# Set SRIOV_ENABLED
echo SRIOV_ENABLED=true >> $GITHUB_ENV
if [[ "${{ matrix.config.node_type }}" != "n3.xlarge.x86" ]]; then
echo SRIOV_ENABLED=false >> $GITHUB_ENV
fi

# Set CLUSTER_NAME and SSH_KEY
node_type=${{ matrix.config.node_type }}
id=${node_type:0:2}-${{ github.run_number }}
if [[ "${{ matrix.config.CNI }}" == "calico-vpp" ]]; then
id=c-${id}
fi
echo CLUSTER_NAME=nsm-ci-${id} >> $GITHUB_ENV
echo SSH_KEY=nsm-ssh-${id} >> $GITHUB_ENV

# Checking server availability by metro and node_type
- name: Find metro
run: |
metros_to_check=da,ny
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then
if [[ "${{ matrix.config.CNI }}" == "calico-vpp" ]]; then
metros_to_check=at,ch
elif [[ "${{ matrix.config.node_type }}" == "c3.large.arm64" ]]; then
metros_to_check=da,dc
fi
METRO=$(metal capacity check -m ${metros_to_check} -P n3.xlarge.x86 -q 2 -o json | jq -r '[.[] | select( .available == true ) | .metro][0]')
METRO=$(metal capacity check -m ${metros_to_check} -P "${{ matrix.config.node_type }}" -q 2 -o json | jq -r '[.[] | select( .available == true ) | .metro][0]')
if [ ${METRO} == "null" ]; then
exit 1;
fi
Expand Down Expand Up @@ -111,7 +144,7 @@ jobs:
- name: Setup cluster
uses: nick-fields/[email protected]
with:
timeout_minutes: 50
timeout_minutes: 60
max_attempts: 3
command: |
cd ${{ github.repository }}
Expand All @@ -127,17 +160,19 @@ jobs:
PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18
NODE_OS: ubuntu_20_04
KUBERNETES_VERSION: "v1.27.1"
CNI: ${{ matrix.CNI }}
CONTROLPLANE_NODE_TYPE: "n3.xlarge.x86"
WORKER_NODE_TYPE: "n3.xlarge.x86"
CNI: ${{ matrix.config.CNI }}
CONTROLPLANE_NODE_TYPE: ${{ matrix.config.node_type }}
WORKER_NODE_TYPE: ${{ matrix.config.node_type }}

- name: Integration tests
run: |
export KUBECONFIG=$HOME/.kube/config_packet
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then
go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4 || true
if [[ "${{ matrix.config.CNI }}" == "calico-vpp" ]]; then
go test -count 1 -timeout 1h50m -race -v ./test/${{ matrix.config.CNI }} -parallel 4 || true
elif [ "${SRIOV_ENABLED}" == true ]; then
go test -count 1 -timeout 1h50m -race -v ./test/${{ matrix.config.CNI }} -parallel 4
else
go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4
go test -count 1 -timeout 1h50m -race -v ./test/${{ matrix.config.CNI }}/main_test.go -parallel 4
fi
env:
ARTIFACTS_DIR: logs
Expand All @@ -147,8 +182,8 @@ jobs:
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: ${{ matrix.CNI }}-logs
path: ${{ github.repository }}/tests_${{ matrix.CNI }}/logs
name: ${{ matrix.config.node_type }}-${{ matrix.config.CNI }}-logs
path: ${{ github.repository }}/test/${{ matrix.config.CNI }}/logs

- name: Cleanup
if: ${{ always() }}
Expand Down
6 changes: 4 additions & 2 deletions scripts/setup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ done

# Wait for packet servers to be ready
sleep 30s
kubectl wait --timeout=30m --for=condition=Ready=true packetmachine -l cluster.x-k8s.io/cluster-name=${CLUSTER_NAME}
kubectl wait --timeout=50m --for=condition=Ready=true packetmachine -l cluster.x-k8s.io/cluster-name=${CLUSTER_NAME}
result=$?
if [ $result -ne 0 ]; then
clusterctl describe cluster ${CLUSTER_NAME} --echo
Expand Down Expand Up @@ -96,7 +96,9 @@ for i in {1..30}; do
done

## Setup SR-IOV
/bin/bash scripts/sriov/setup-SRIOV.sh "${master_node}" "${master_ip}" "${worker_node}" "${worker_ip}" "${sriov_vlan}" "${enable8021q}" "${SSH_OPTS}" || exit 12
if [[ "$SRIOV_ENABLED" == true ]]; then
/bin/bash scripts/sriov/setup-SRIOV.sh "${master_node}" "${master_ip}" "${worker_node}" "${worker_ip}" "${sriov_vlan}" "${enable8021q}" "${SSH_OPTS}" || exit 12
fi

## Remove master label from the control-plane node to be able to use it as worker node
# For some versions of kubernetes you need to use node-role.kubernetes.io/master-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -16,7 +16,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package main_test
package calico_vpp_test

import (
"testing"
Expand Down
28 changes: 28 additions & 0 deletions test/default/feature_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package default_test

import (
"testing"

"github.com/networkservicemesh/integration-tests/extensions/parallel"
"github.com/networkservicemesh/integration-tests/suites/features"
)

func TestFeatureSuite(t *testing.T) {
parallel.Run(t, new(features.Suite), "TestVl3_ipv6", "TestVl3_dns", "TestVl3_lb", "TestVl3_scale_from_zero", "TestScale_from_zero", "TestSelect_forwarder")
}
29 changes: 29 additions & 0 deletions test/default/heal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package default_test

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/networkservicemesh/integration-tests/suites/heal"
)

func TestHeal(t *testing.T) {
suite.Run(t, new(heal.Suite))
}
40 changes: 40 additions & 0 deletions test/default/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package default_test

import (
"testing"

"github.com/networkservicemesh/integration-tests/extensions/parallel"
"github.com/networkservicemesh/integration-tests/suites/basic"
"github.com/networkservicemesh/integration-tests/suites/ipsec_mechanism"
"github.com/networkservicemesh/integration-tests/suites/memory"
)

func TestBasic(t *testing.T) {
parallel.Run(t, new(basic.Suite))
}

func TestMemory(t *testing.T) {
parallel.Run(t, new(memory.Suite))
}

func TestIPSec(t *testing.T) {
parallel.Run(t, new(ipsec_mechanism.Suite))
}
29 changes: 29 additions & 0 deletions test/default/observ_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package default_test

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/networkservicemesh/integration-tests/suites/observability"
)

func TestRunObservabilitySuite(t *testing.T) {
suite.Run(t, new(observability.Suite))
}
27 changes: 2 additions & 25 deletions tests_default/main_test.go → test/default/sriov_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
//
// Copyright (c) 2023 Cisco and/or its affiliates.
// Copyright (c) 2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -16,42 +14,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package main_test
package default_test

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/networkservicemesh/integration-tests/extensions/parallel"
"github.com/networkservicemesh/integration-tests/suites/features"
"github.com/networkservicemesh/integration-tests/suites/heal"
"github.com/networkservicemesh/integration-tests/suites/memory"
"github.com/networkservicemesh/integration-tests/suites/multiforwarder_vlantag"
"github.com/networkservicemesh/integration-tests/suites/observability"
"github.com/networkservicemesh/integration-tests/suites/sriov_vlantag"
)

func TestMemory(t *testing.T) {
parallel.Run(t, new(memory.Suite))
}

func TestSRIOV_VlanTag(t *testing.T) {
suite.Run(t, new(sriov_vlantag.Suite))
}

func TestMultiForwarder_VlanTag(t *testing.T) {
suite.Run(t, new(multiforwarder_vlantag.Suite))
}

func TestHeal(t *testing.T) {
suite.Run(t, new(heal.Suite))
}

func TestRunObservabilitySuite(t *testing.T) {
suite.Run(t, new(observability.Suite))
}

func TestFeatureSuite(t *testing.T) {
parallel.Run(t, new(features.Suite), "TestVl3_basic", "TestVl3_dns", "TestScale_from_zero", "TestVl3_scale_from_zero", "TestSelect_forwarder")
}
Loading