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#32

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

networkservicemesh/cmd-template commit message:
commit 220aa9a891bc5b8961b5791ddaddb44f8b7ae1a1
Author: Denis Tingaikin <[email protected]>
Date:   Fri Nov 6 00:34:45 2020 +0700

    Simplify scripts and review comments (#32)

    Signed-off-by: Denis Tingajkin <[email protected]>

Signed-off-by: NSMBot <[email protected]>
  • Loading branch information
NSMBot committed Nov 5, 2020
1 parent df2ec9b commit 116ad17
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 41 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ jobs:
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USER: ${{ secrets.DOCKER_LOGIN }}
TAG: ${GITHUB_SHA::8}
ORG: networkservicemeshci
CGO_ENABLED: 0
NAME: ${{ github.event.repository.name }}
Expand All @@ -177,12 +176,12 @@ jobs:
with:
go-version: 1.15
- name: Build ${NAME} image
run: docker build . -t "${ORG}/${NAME}:${TAG}" --target runtime
run: docker build . -t "${ORG}/${NAME}:${GITHUB_SHA::8}" --target runtime
- name: Push ${NAME} image
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
docker push "${ORG}/${NAME}:${TAG}"
docker image rm "${ORG}/${NAME}:${TAG}"
docker push "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker image rm "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker push "${ORG}/${NAME}:latest"
docker image rm "${ORG}/${NAME}:latest"
Expand All @@ -209,23 +208,24 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-integration-k8s-kind:
needs:
- automerge
name: Update integration-k8s-kind
runs-on: ubuntu-latest
if: github.repository != 'networkservicemesh/cmd-template'
if: github.repository != 'networkservicemesh/cmd-template' && github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request'
steps:
- name: Checkout repository
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v2
- name: Find merged PR
uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
github-token: ${{ github.token }}
path: ${{ github.repository }}S
ref: master
fetch-depth: '0'
- name: Create commit message
working-directory: ${{ github.repository }}
run: |
echo "Update image version of ${{ github.repository }} ${{ github.repository }}#${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message
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/${{ steps.findPr.outputs.pr }}" >> /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
Expand All @@ -237,9 +237,6 @@ jobs:
path: networkservicemesh/integration-k8s-kind
repository: networkservicemesh/integration-k8s-kind
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
- uses: benjlevesque/[email protected]
id: short-sha
with:
Expand Down Expand Up @@ -269,7 +266,7 @@ jobs:
git config --global user.name "NSMBot"
git commit -s -F /tmp/commit-message
git checkout -b update/"${branchName}"
while [ git push -f origin update/"${branchName}" ]; do
while [ git push origin update/"${branchName}" ]; do
git fetch origin update/"${branchName}"
git rebase origin/update/"${branchName}"
done
7 changes: 3 additions & 4 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USER: ${{ secrets.DOCKER_LOGIN }}
TAG: ${GITHUB_SHA::8}
ORG: networkservicemeshci
CGO_ENABLED: 0
NAME: ${{ github.event.repository.name }}
Expand All @@ -22,11 +21,11 @@ jobs:
with:
go-version: 1.15
- name: Build ${NAME} image
run: docker build . -t "${ORG}/${NAME}:${TAG}" --target runtime
run: docker build . -t "${ORG}/${NAME}:${GITHUB_SHA::8}" --target runtime
- name: Push ${NAME} image
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
docker push "${ORG}/${NAME}:${TAG}"
docker image rm "${ORG}/${NAME}:${TAG}"
docker push "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker image rm "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker push "${ORG}/${NAME}:latest"
docker image rm "${ORG}/${NAME}:latest"
15 changes: 5 additions & 10 deletions .github/workflows/update-cmd-repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,17 @@ jobs:
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")
{
git restore --staged -- .templateignore &&
git restore -- .templateignore
} || {
rm .templateignore
if [ ! -f .templateignore ]; then
touch .templateignore
git add .templateignore
}
fi
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")
git restore -- .templateignore
while read -r line || [[ -n "$line" ]]; do
git restore --staged -- $line
git restore -- $line
done < .templateignore
git restore --staged -- $(cat .templateignore)
git restore -- $(cat .templateignore)
if ! [ -n "$(git diff --cached --exit-code)" ]; then
exit 0;
fi
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/update-integration-k8s-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ jobs:
runs-on: ubuntu-latest
if: github.repository != 'networkservicemesh/cmd-template'
steps:
- name: Checkout repository
- name: Checkout ${{ github.repository }} code
uses: actions/checkout@v2
- 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 image version of ${{ github.repository }} ${{ github.repository }}#${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message
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/${{ steps.findPr.outputs.pr }}" >> /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
Expand All @@ -35,9 +30,6 @@ jobs:
path: networkservicemesh/integration-k8s-kind
repository: networkservicemesh/integration-k8s-kind
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
- uses: benjlevesque/[email protected]
id: short-sha
with:
Expand Down

0 comments on commit 116ad17

Please sign in to comment.