Skip to content

Commit

Permalink
Merge branch 'main' into ANCX_QOS11
Browse files Browse the repository at this point in the history
  • Loading branch information
arulkumarsekar authored Jul 10, 2023
2 parents 19d2148 + a30cedd commit d47e3c9
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 135 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 0 * * *"

jobs:
build:
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/protobufs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Protobufs

on:
push:
branches: [ main ]
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
validate_protobufs:
name: Validate Protobufs
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
- name: Checkout code
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Install protobuf
uses: arduino/setup-protoc@v1
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint protobufs
run: |
go install github.com/googleapis/api-linter/cmd/api-linter@latest
# Set directory to hold symlink
readonly PROTOBUF_IMPORT_DIR='protobuf-import'
mkdir -p "${PROTOBUF_IMPORT_DIR}"
# Remove any existing symlinks & empty directories
find "${PROTOBUF_IMPORT_DIR}" -type l -delete
find "${PROTOBUF_IMPORT_DIR}" -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
go list -f "${PROTOBUF_IMPORT_DIR}/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f "{{ .Dir }} "${PROTOBUF_IMPORT_DIR}"/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
find . -name \*.proto -exec api-linter -I./"${PROTOBUF_IMPORT_DIR}" --disable-rule all --enable-rule core {} \+
- name: Compile topology binding textprotos
run: |
fail=0
# Set directory to hold symlink
readonly PROTOBUF_IMPORT_DIR='protobuf-import'
mkdir -p "${PROTOBUF_IMPORT_DIR}"
# Remove any existing symlinks & empty directories
find "${PROTOBUF_IMPORT_DIR}" -type l -delete
find "${PROTOBUF_IMPORT_DIR}" -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
go list -f "${PROTOBUF_IMPORT_DIR}/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f "{{ .Dir }} \"${PROTOBUF_IMPORT_DIR}\"/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
for i in `find topologies/ -type f -name "*.binding"`; do
if ! output=$(protoc -I="${PROTOBUF_IMPORT_DIR}" --proto_path=topologies/proto --encode=openconfig.testing.Binding topologies/proto/binding.proto < $i 2>&1 >/dev/null); then
fail=1
echo -e "Compile $i failed:\n$output\n"
fi
done
if [ "$fail" == "1" ]; then exit 1; fi
- name: Compile feature profile textprotos
run: |
fail=0
for i in `find feature/ -type f -name "feature.textproto"`; do
if ! output=$(protoc --encode=openconfig.profiles.FeatureProfile proto/feature.proto < $i 2>&1 >/dev/null); then
fail=1
echo -e "Compile $i failed:\n$output\n"
fi
done
if [ "$fail" == "1" ]; then exit 1; fi
validate_oc_paths:
name: Validate OpenConfig Paths
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
- name: Checkout code
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Fetch Openconfig Models
run: make openconfig_public
- name: Validate Paths
run: make validate_paths

95 changes: 0 additions & 95 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,6 @@
name: Pull Request
on: [pull_request]
jobs:
validate_protobufs:
name: Validate Protobufs
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
- name: Checkout code
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Install protobuf
uses: arduino/setup-protoc@v1
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint protobufs
run: |
go install github.com/googleapis/api-linter/cmd/api-linter@latest
# Set directory to hold symlink
readonly PROTOBUF_IMPORT_DIR='protobuf-import'
mkdir -p "${PROTOBUF_IMPORT_DIR}"
# Remove any existing symlinks & empty directories
find "${PROTOBUF_IMPORT_DIR}" -type l -delete
find "${PROTOBUF_IMPORT_DIR}" -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
go list -f "${PROTOBUF_IMPORT_DIR}/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f "{{ .Dir }} "${PROTOBUF_IMPORT_DIR}"/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
find . -name \*.proto -exec api-linter -I./"${PROTOBUF_IMPORT_DIR}" --disable-rule all --enable-rule core {} \+
- name: Compile topology binding textprotos
run: |
fail=0
# Set directory to hold symlink
readonly PROTOBUF_IMPORT_DIR='protobuf-import'
mkdir -p "${PROTOBUF_IMPORT_DIR}"
# Remove any existing symlinks & empty directories
find "${PROTOBUF_IMPORT_DIR}" -type l -delete
find "${PROTOBUF_IMPORT_DIR}" -type d -empty -delete
# Download the required dependencies
go mod download
# Get ondatra modules we use and create required directory structure
go list -f "${PROTOBUF_IMPORT_DIR}/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 dirname | sort | uniq | xargs mkdir -p
# Create symlink
go list -f "{{ .Dir }} \"${PROTOBUF_IMPORT_DIR}\"/{{ .Path }}" -m github.com/openconfig/ondatra | xargs -L1 -- ln -s
for i in `find topologies/ -type f -name "*.binding"`; do
if ! output=$(protoc -I="${PROTOBUF_IMPORT_DIR}" --proto_path=topologies/proto --encode=openconfig.testing.Binding topologies/proto/binding.proto < $i 2>&1 >/dev/null); then
fail=1
echo -e "Compile $i failed:\n$output\n"
fi
done
if [ "$fail" == "1" ]; then exit 1; fi
- name: Compile feature profile textprotos
run: |
fail=0
for i in `find feature/ -type f -name "feature.textproto"`; do
if ! output=$(protoc --encode=openconfig.profiles.FeatureProfile proto/feature.proto < $i 2>&1 >/dev/null); then
fail=1
echo -e "Compile $i failed:\n$output\n"
fi
done
if [ "$fail" == "1" ]; then exit 1; fi
validate_oc_paths:
name: Validate OpenConfig Paths
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.19'
- name: Checkout code
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ github.job }}-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ github.job }}-${{ runner.os }}-go-build-
- name: Fetch Openconfig Models
run: make openconfig_public
- name: Validate Paths
run: make validate_paths

check_style:
name: Check style against CONTRIBUTING.md
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ require (
github.com/openconfig/ygot v0.28.3
github.com/p4lang/p4runtime v1.4.0-rc.5
github.com/protocolbuffers/txtpbfmt v0.0.0-20220608084003-fc78c767cd6a
github.com/yuin/goldmark v1.4.13
golang.org/x/crypto v0.10.0
golang.org/x/text v0.10.0
google.golang.org/api v0.122.0
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,6 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
Expand Down
3 changes: 3 additions & 0 deletions tools/ci-trigger/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func (p *pullRequest) createBuild(ctx context.Context, buildClient *cloudbuild.S
for _, d := range devices {
for i, virtualDevice := range p.Virtual {
if virtualDevice.Type == d {
if len(virtualDevice.Tests) == 0 {
continue
}
skip := false
for _, v := range virtualDevice.Tests {
if v.Status != "pending authorization" {
Expand Down
10 changes: 10 additions & 0 deletions tools/ci-trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ func (t *trigger) processPullRequest(ctx context.Context, e *github.PullRequestE
return fmt.Errorf("identify modified tests: %w", err)
}

auth, err := t.authorizedUser(ctx, e.GetPullRequest().GetUser().GetLogin())
if err != nil {
return fmt.Errorf("validating user auth: %w", err)
}
if auth {
if err := pr.createBuild(ctx, t.buildClient, t.storClient, virtualDeviceTypes); err != nil {
return fmt.Errorf("create build: %w", err)
}
}

if err := pr.updateBadges(ctx, t.storClient); err != nil {
return fmt.Errorf("update GCS badges: %w", err)
}
Expand Down
Loading

0 comments on commit d47e3c9

Please sign in to comment.