-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Denis Tingajkin <denis.tingajkin@xored.com>
- Loading branch information
1 parent
9b3e680
commit 869a144
Showing
16 changed files
with
1,391 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
--- | ||
name: ci | ||
on: [pull_request, push] | ||
jobs: | ||
yamllint: | ||
name: yamllint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
- name: Install yamllint | ||
run: pip install --user yamllint | ||
- name: Run yamllint | ||
run: ~/.local/bin/yamllint -c .yamllint.yml --strict . | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: shellcheck | ||
uses: fkautz/shell-linter@v1.0.1 | ||
golangci-lint: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
env: | ||
GOLANGCI_LINT_CONTAINER: golangci/golangci-lint:v1.28.1 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Pull golangci-lint docker container | ||
run: docker pull ${GOLANGCI_LINT_CONTAINER} | ||
- name: Run golangci-lint | ||
run: | | ||
cd integraiton | ||
docker run --rm -v $(pwd):/app -w /app ${GOLANGCI_LINT_CONTAINER} golangci-lint run | ||
excludeFmtErrorf: | ||
name: exclude fmt.Errorf | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Exclude fmt.Errorf | ||
run: | | ||
if grep -r --include=*.go --exclude=*.pb.go fmt.Errorf . ; then | ||
echo "Please use errors.Errorf (or errors.New or errors.Wrap or errors.Wrapf) as appropriate rather than fmt.Errorf" | ||
exit 1 | ||
fi | ||
restrictNSMDeps: | ||
name: Restrict dependencies on github.com/networkservicemesh/* | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Restrict dependencies on github.com/networkservicemesh/* | ||
run: | | ||
for i in $(grep github.com/networkservicemesh/ go.mod |grep -v '^module' | sed 's;.*\(github.com\/networkservicemesh\/[a-zA-z\/]*\).*;\1;g' | sort -u);do | ||
if [ "${i}" != "github.com/networkservicemesh/api" ]; then | ||
echo Dependency on "${i}" is forbidden | ||
exit 1 | ||
fi | ||
done | ||
checkgomod: | ||
name: check go.mod and go.sum | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.4 | ||
- run: go mod tidy | ||
- name: Check for changes in go.mod or go.sum | ||
run: | | ||
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false ) | ||
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) | ||
gogenerate: | ||
name: Check generated files | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: arduino/setup-protoc@master | ||
with: | ||
version: '3.8.0' | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
- name: Install proto-gen-go | ||
run: go get -u github.com/golang/protobuf/protoc-gen-go@v1.3.3 | ||
- name: Install proto-gen-go | ||
run: go get github.com/searKing/golang/tools/cmd/go-syncmap | ||
- name: Generate files | ||
run: go generate ./... | ||
- name: Check for changes in generated code | ||
run: | | ||
git diff -- '*.pb.go' || ( echo "Rerun go generate ./... locally and resubmit" && false ) | ||
git diff -- '*.gen.go' || ( echo "Rerun go generate ./... locally and resubmit" && false ) | ||
excludereplace: | ||
name: Exclude Replace in go.mod | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
- name: Exclude replace in go.mod | ||
run: | | ||
grep ^replace go.mod || exit 0 | ||
exit 1 | ||
captureRunEnv: | ||
name: Capture CI Run Env | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: printenv | ||
automerge: | ||
name: automerge | ||
runs-on: ubuntu-latest | ||
needs: | ||
- kind | ||
if: github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request' | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
- name: Fetch master | ||
run: | | ||
git remote -v | ||
git fetch --depth=1 origin master | ||
- name: Only allow go.mod and go.sum changes | ||
run: | | ||
find . -type f ! -name 'go.mod' ! -name 'go.sum' -exec git diff --exit-code origin/master -- {} + | ||
- name: Automerge nsmbot PR | ||
uses: ridedott/merge-me-action@master | ||
with: | ||
GITHUB_LOGIN: nsmbot | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
kind: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: engineerd/setup-kind@v0.4.0 | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- name: Integration tests | ||
run: | | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
- name: Install gotestsum | ||
run: go get gotest.tools/gotestsum@v0.4.0 | ||
- name: Run tests | ||
run: | | ||
eval $(go env) | ||
mkdir -p ~/junit/ | ||
${GOPATH}/bin/gotestsum --junitfile ~/junit/unit-tests.xml -- -race -short $(go list ./...) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## Copyright headers for source code | ||
This folder contains the copyright templates for source files of NSM project. | ||
|
||
Below is an example of valid copyright header for `.go` files: | ||
``` | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 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. | ||
``` | ||
Note you can use your company name instead of `Cisco and/or its affiliates`. | ||
Also, source code files can have multi copyright holders, for example: | ||
``` | ||
// Copyright (c) 2020 Doc.ai and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Cisco and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 Red Hat Inc. and/or its affiliates. | ||
// | ||
// Copyright (c) 2020 VMware, Inc. | ||
// | ||
// 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. | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{copyright-holders}}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. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
extends: default | ||
|
||
yaml-files: | ||
- '*.yaml' | ||
- '*.yml' | ||
|
||
rules: | ||
truthy: disable | ||
# 80 chars should be enough, but don't fail if a line is longer | ||
line-length: disable | ||
comments-indentation: | ||
ignore: .circleci/config.yml | ||
|
||
ignore: scripts/aws/aws-k8s-cni.yaml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
# integration-k8s-kind | ||
# integration-k8s-kind | ||
|
||
How to run integration tests locally? | ||
```bash | ||
kind create cluster --name="$(KIND_CLUSTER_NAME)" --config cluster-config.yaml --wait 120s | ||
go test ./integration/... | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
kind: Cluster | ||
apiVersion: kind.sigs.k8s.io/v1alpha3 | ||
nodes: | ||
- role: control-plane | ||
- role: worker | ||
- role: worker |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: This folder should be removed when we've completed all NSM applications. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: This folder should be removed when we've created repository for NSM deployments. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: alpine | ||
labels: | ||
app: alpine | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: alpine | ||
template: | ||
metadata: | ||
labels: | ||
app: alpine | ||
spec: | ||
containers: | ||
- image: alpine:latest | ||
command: | ||
- /bin/sh | ||
- "-c" | ||
- "sleep 60m" | ||
imagePullPolicy: IfNotPresent | ||
name: alpine |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
module github.com/networkservicemesh/integration-k8s-kind/tests | ||
|
||
go 1.14 | ||
|
||
require ( | ||
github.com/edwarnicke/exechelper v1.0.1 | ||
github.com/sirupsen/logrus v1.6.0 | ||
github.com/stretchr/testify v1.6.1 | ||
golang.org/x/text v0.3.3 // indirect | ||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect | ||
google.golang.org/appengine v1.6.6 // indirect | ||
google.golang.org/protobuf v1.25.0 // indirect | ||
gopkg.in/yaml.v2 v2.3.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect | ||
k8s.io/api v0.18.1 // indirect | ||
k8s.io/apimachinery v0.18.1 // indirect | ||
k8s.io/client-go v11.0.0+incompatible | ||
k8s.io/kubernetes v1.18.1 // indirect | ||
) | ||
|
||
replace ( | ||
github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 => github.com/census-instrumentation/opencensus-proto v0.0.3-0.20181214143942-ba49f56771b8 | ||
gonum.org/v1/gonum => github.com/gonum/gonum v0.0.0-20190331200053-3d26580ed485 | ||
gonum.org/v1/netlib => github.com/gonum/netlib v0.0.0-20190331212654-76723241ea4e | ||
k8s.io/api => k8s.io/api v0.18.1 | ||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.1 | ||
k8s.io/apimachinery => k8s.io/apimachinery v0.18.2-beta.0 | ||
k8s.io/apiserver => k8s.io/apiserver v0.18.1 | ||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.1 | ||
k8s.io/client-go => k8s.io/client-go v0.18.1 | ||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.1 | ||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.1 | ||
k8s.io/code-generator => k8s.io/code-generator v0.18.2-beta.0 | ||
k8s.io/component-base => k8s.io/component-base v0.18.1 | ||
k8s.io/cri-api => k8s.io/cri-api v0.18.2-beta.0 | ||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.1 | ||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.1 | ||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.1 | ||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.1 | ||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.1 | ||
k8s.io/kubectl => k8s.io/kubectl v0.18.1 | ||
k8s.io/kubelet => k8s.io/kubelet v0.18.1 | ||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.1 | ||
k8s.io/metrics => k8s.io/metrics v0.18.1 | ||
k8s.io/node-api => k8s.io/node-api v0.17.1 | ||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.1 | ||
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.18.1 | ||
k8s.io/sample-controller => k8s.io/sample-controller v0.18.1 | ||
) |
Oops, something went wrong.