Skip to content

Commit

Permalink
Update common CI files to latest version from networkservicemesh/cmd-…
Browse files Browse the repository at this point in the history
…template@master networkservicemesh/cmd-template#27

networkservicemesh/cmd-template PR link: networkservicemesh/cmd-template#27

networkservicemesh/cmd-template commit message:
commit 4dbacb1f83ec4076fd7ee481fcd4ea45310e545a
Author: Denis Tingaikin <49399980+denis-tingajkin@users.noreply.github.com>
Date:   Sun Oct 25 22:01:59 2020 +0700

    fix: cmd-template cannot update dependent repositories (#27)

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

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
  • Loading branch information
NSMBot committed Oct 25, 2020
1 parent 2fb6cae commit 6ab11c4
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13.4
go-version: 1.15
- name: Build
run: go build -race ./...
golangci-lint:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
go-version: 1.15
- run: go mod tidy
- name: Check for changes in go.mod or go.sum
run: |
Expand All @@ -103,7 +103,7 @@ jobs:
version: '3.8.0'
- uses: actions/setup-go@v1
with:
go-version: 1.13
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
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
go-version: 1.15
- name: Build container
run: docker build .
- name: Run tests
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
go-version: 1.15
- name: Build ${NAME} image
run: docker build . -t "${ORG}/${NAME}:${TAG}" --target runtime
- name: Push ${NAME} image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
go-version: 1.15
- name: Build ${NAME} image
run: docker build . -t "${ORG}/${NAME}:${TAG}" --target runtime
- name: Push ${NAME} image
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/update-cmd-repositories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Update dependent repositories
on:
push:
branches:
- master

jobs:
update-dependent-repositories:
strategy:
matrix:
repository: [cmd-registry-proxy-dns, cmd-nsc, cmd-registry-memory, cmd-nsmgr, cmd-forwarder-vppagent, cmd-exclude-prefixes-k8s]
name: Update ${{ matrix.repository }}
runs-on: ubuntu-latest
if: github.repository == 'networkservicemesh/cmd-template'
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v2
with:
path: ${{ github.repository }}
repository: ${{ github.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- name: Find merged PR
uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
github-token: ${{ github.token }}
- name: Create commit message
working-directory: ${{ github.repository }}
run: |
echo "Update common CI files to latest version from ${{ github.repository }}@master ${{ github.repository }}#${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message
echo "" >> /tmp/commit-message
echo "${{ github.repository }} PR link: https://github.com/${{ github.repository }}/pull/${{ steps.findPr.outputs.pr }}" >> /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: Checkout networkservicemesh/${{ matrix.repository }}
uses: actions/checkout@v2
with:
path: networkservicemesh/${{ matrix.repository }}
repository: networkservicemesh/${{ matrix.repository }}
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Push update to the ${{ matrix.repository }}
working-directory: networkservicemesh/${{ matrix.repository }}
run: |
echo Starting to update repositotry ${{ matrix.repository }}
git config --global user.email "nsmbot@networkservicmesh.io"
git config --global user.name "NSMBot"
git remote add cmd_template https://github.com/networkservicemesh/cmd-template.git
git fetch cmd_template
git diff cmd_template/master -R | git apply
git add $(git ls-tree --name-only -r cmd_template/master | grep ".*\.yml\|.*\.yaml\|.*\.md\|.*\.txt\|.*.\.conf")
if ! [ "$(git restore --staged -- .templateignore)" ]; then
git restore -- .templateignore
fi
if ! [ "$(git restore --staged -- $(cat .templateignore))" ]; then
git restore -- $(cat .templateignore)
fi
if ! [ -n "$(git diff --cached --exit-code)" ]; then
exit 0;
fi
git commit -s -F /tmp/commit-message
git checkout -b update/${{ github.repository }}
git push -f origin update/${{ github.repository }}

0 comments on commit 6ab11c4

Please sign in to comment.