Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from update/networkservicemesh/cmd-template #80

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ 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
Expand All @@ -82,6 +83,7 @@ jobs:
exit 1
fi;
done

checkgomod:
name: Check go.mod and go.sum
runs-on: ubuntu-latest
Expand All @@ -94,6 +96,7 @@ jobs:
- name: Check for changes
run: |
git diff --name-only --exit-code || ( echo "Run go mod tidy" && false )

gogenerate:
name: Check generated files
runs-on: ubuntu-latest
Expand All @@ -106,6 +109,7 @@ jobs:
- name: Check for changes
run: |
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 @@ -116,6 +120,7 @@ jobs:
run: |
grep ^replace go.mod || exit 0
exit 1

docker:
name: Docker Build & Test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -144,32 +149,3 @@ jobs:
pr-${{ steps.findPr.outputs.pr }}
commit-${{ github.sha }}
latest
pushImage:
name: Push docker image
runs-on: ubuntu-latest
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USER: ${{ secrets.DOCKER_LOGIN }}
ORG: networkservicemeshci
CGO_ENABLED: 0
NAME: ${{ github.event.repository.name }}
needs:
- build
- docker
if: github.actor == 'nsmbot' && github.base_ref == 'master' && github.event_name == 'pull_request' && github.repository != 'networkservicemesh/cmd-template'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
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
run: docker build . -t "${ORG}/${NAME}" --target runtime
- name: Push ${NAME} images
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
docker push "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker image rm "${ORG}/${NAME}:${GITHUB_SHA::8}"
docker push "${ORG}/${NAME}"
docker image rm "${ORG}/${NAME}"
9 changes: 7 additions & 2 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
push:
branches:
- master
workflow_run:
types:
- completed
workflows:
- 'automerge'
jobs:
pushImage:
name: Push docker image
Expand All @@ -14,12 +19,12 @@ jobs:
ORG: networkservicemeshci
CGO_ENABLED: 0
NAME: ${{ github.event.repository.name }}
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:
- 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 Down