Skip to content

Commit

Permalink
fix issue related to sync with latest cmd-template (networkservicemes…
Browse files Browse the repository at this point in the history
…h#62)

* fix issue related to sync with latest cmd-template

Signed-off-by: Denis Tingaikin <denis.tingajkin@xored.com>

* regenerate imports

Signed-off-by: Denis Tingaikin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin authored Apr 13, 2021
1 parent c5019b1 commit e093406
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 176 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/automerge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: automerge
on:
workflow_run:
types:
- completed
workflows:
- 'ci'
jobs:
automerge:
name: Automerge
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' }}
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' ! -name '*.yaml' ! -name '*.yml' ! -name '*.txt' ! -name '*.md' ! -name '*.conf' -exec git diff --exit-code origin/master -- {} +
- name: Merge PR
uses: ridedott/merge-me-action@master
with:
GITHUB_LOGIN: nsmbot
ENABLED_FOR_MANUAL_CHANGES: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115 changes: 12 additions & 103 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: 1.16
- name: Build
run: go build -race ./...

Expand Down Expand Up @@ -67,59 +67,45 @@ jobs:
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/*
env:
ALLOWED_REPOSITORIES: "sdk, api, sdk-k8s, sdk-vppagent, sdk-sriov"
ALLOWED_REPOSITORIES: "sdk, api, sdk-k8s, sdk-vpp, sdk-sriov"
run: |
for i in $(grep github.com/networkservicemesh/ go.mod | grep -v '^module' | sed 's;.*\(github.com\/networkservicemesh\/[^ ]*\).*;\1;g');do
if ! [ "$(echo ${ALLOWED_REPOSITORIES} | grep ${i#github.com/networkservicemesh/})" ]; then
echo Dependency on "${i}" is forbidden
exit 1
fi;
done
checkgomod:
name: check go.mod and go.sum
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.15
go-version: 1.16
- run: go mod tidy
- name: Check for changes in go.mod or go.sum
- name: Check for changes
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 )
git diff --name-only --exit-code || ( echo "Run go mod 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.15
- 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
go-version: 1.16
- run: go generate ./...
- name: Check for changes
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 )
git diff --name-only --exit-code || ( echo "Rerun go generate ./... locally and resubmit" && false )
excludereplace:
name: Exclude Replace in go.mod
runs-on: ubuntu-latest
Expand All @@ -130,7 +116,6 @@ jobs:
run: |
grep ^replace go.mod || exit 0
exit 1
docker:
name: Docker Build & Test
runs-on: ubuntu-latest
Expand All @@ -139,7 +124,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: 1.16
- name: Build container
run: docker build .
- name: Run tests
Expand All @@ -159,7 +144,6 @@ jobs:
pr-${{ steps.findPr.outputs.pr }}
commit-${{ github.sha }}
latest
pushImage:
name: Push docker image
runs-on: ubuntu-latest
Expand All @@ -177,7 +161,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: 1.16
- name: Build ${NAME}:${GITHUB_SHA::8} image
run: docker build . -t "${ORG}/${NAME}:${GITHUB_SHA::8}" --target runtime
- name: Build ${NAME}:latest image
Expand All @@ -189,78 +173,3 @@ jobs:
docker image rm "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker push "${ORG}/${NAME}"
docker image rm "${ORG}/${NAME}"
automerge:
name: automerge
runs-on: ubuntu-latest
needs:
- update-deployments-k8s
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: NSMBot should update only config files
run: find . -type f ! -name 'go.mod' ! -name 'go.sum' ! -name '*.yaml' ! -name '*.yml' ! -name '*.txt' ! -name '*.md' ! -name '*.conf' -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 }}

update-deployments-k8s:
name: Update deployments-k8s
runs-on: ubuntu-latest
needs:
- pushImage
if: github.repository != 'networkservicemesh/cmd-template' && github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request'
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v2
with:
path: ${{ github.repository }}
repository: ${{ github.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- uses: benjlevesque/short-sha@v1.2
id: short-sha
with:
length: 8
- name: Checkout networkservicemesh/deployments-k8s
uses: actions/checkout@v2
with:
path: networkservicemesh/deployments-k8s
repository: networkservicemesh/deployments-k8s
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- name: Create commit message
working-directory: ${{ github.repository }}
run: |
echo "Update application version to latest version from ${{ github.repository }}@master ${{ github.repository }}#${{ github.event.number }}" > /tmp/commit-message
echo "" >> /tmp/commit-message
echo "${{ github.repository }} PR link: https://github.com/${{ github.repository }}/pull/${{ github.event.number }}" >> /tmp/commit-message
echo "" >> /tmp/commit-message
echo "${{ github.repository }} commit message:" >> /tmp/commit-message
git log -1 >> /tmp/commit-message
echo "Commit Message:"
cat /tmp/commit-message
- name: Find and Replace version
uses: jacobtomlinson/gha-find-replace@master
with:
find: "${{ github.event.repository.name }}:.*\n"
replace: "${{ github.event.repository.name }}:${{ steps.short-sha.outputs.sha }}\n"
- name: Push update to the deployments-k8s
working-directory: networkservicemesh/deployments-k8s
run: |
echo Starting to update repositotry deployments-k8s
git add -- .
if ! [ -n "$(git diff --cached --exit-code)" ]; then
echo Repository already up to date
exit 0;
fi
git config --global user.email "nsmbot@networkservicmesh.io"
git config --global user.name "NSMBot"
git commit -s -F /tmp/commit-message
git checkout -b update/${{ github.repository }}
git push -f origin update/${{ github.repository }}
49 changes: 0 additions & 49 deletions .github/workflows/update-cmd-repositories.yaml

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/update-deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ on:
push:
branches:
- master

workflow_run:
types:
- completed
workflows:
- 'automerge'
jobs:
update-deployments-k8s:
name: Update deployments-k8s
runs-on: ubuntu-latest
if: github.repository != 'networkservicemesh/cmd-template'
if: ${{ github.repository != 'networkservicemesh/cmd-template' && (github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.ref == 'refs/heads/master') }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .templateignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
README.md
README.md
.golangci.yml
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/networkservicemesh/cmd-nsc-vpp

go 1.15
go 1.16

require (
github.com/antonfisher/nested-logrus-formatter v1.3.0
Expand All @@ -13,8 +13,9 @@ require (
github.com/networkservicemesh/api v0.0.0-20210403165646-b0b334ca6872
github.com/networkservicemesh/sdk v0.0.0-20210405062928-0d2dc281b97c
github.com/networkservicemesh/sdk-vpp v0.0.0-20210405063250-b9cbf6b70e98
github.com/onsi/ginkgo v1.13.0 // indirect
github.com/onsi/gomega v1.10.1 // indirect
github.com/sirupsen/logrus v1.7.0
github.com/spiffe/go-spiffe/v2 v2.0.0-beta.4
golang.org/x/text v0.3.2 // indirect
google.golang.org/grpc v1.35.0
)
Loading

0 comments on commit e093406

Please sign in to comment.