generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from layer5io/kumarabd/feature/init
v2 nginx adapter
- Loading branch information
Showing
19 changed files
with
500 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,102 @@ | ||
name: Meshery NGINX SM | ||
name: Meshery Nginx SM | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- "*" | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
- master | ||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
lint: | ||
name: Check & Review code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v1 | ||
with: | ||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||
version: v1.32 | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# args: --issues-exit-code=0 | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
# only-new-issues: true | ||
|
||
|
||
build: | ||
name: Build check | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ secrets.GO_VERSION }} | ||
- run: GOPROXY=direct GOSUMDB=off go get -u golang.org/x/lint/golint; go list ./nginx/... | grep -v /vendor/ | xargs -L1 /home/runner/go/bin/golint -set_exit_status | ||
error_check: | ||
name: Error check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ secrets.GO_VERSION }} | ||
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go get -u github.com/kisielk/errcheck; /home/runner/go/bin/errcheck -tags draft ./... | ||
static_check: | ||
name: Static check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ secrets.GO_VERSION }} | ||
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go get -u honnef.co/go/tools/cmd/staticcheck; /home/runner/go/bin/staticcheck -tags draft -checks all ./nginx/... # https://staticcheck.io/docs/checks | ||
vet: | ||
name: Vet | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ secrets.GO_VERSION }} | ||
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go vet -tags draft ./... | ||
sec_check: | ||
name: Security check | ||
runs-on: ubuntu-latest | ||
# needs: [lint, error_check, static_check, vet, sec_check, tests] | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
- name: Run Gosec Security Scanner | ||
uses: securego/gosec@master | ||
with: | ||
args: ./... -exclude=G301,G304,G107,G101,G110 | ||
tests: | ||
# needs: [lint, error_check, static_check, vet, sec_check] | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
- name: Setup Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ secrets.GO_VERSION }} | ||
# TODO(kushthedude): remove the cache clear sub-step once the mod checksum error is solved | ||
- run: | | ||
go clean -modcache | ||
GO111MODULE=on go build . | ||
- name: Create cluster using KinD | ||
uses: engineerd/[email protected] | ||
with: | ||
version: "v0.7.0" | ||
- run: | | ||
export CURRENTCONTEXT="$(kubectl config current-context)" | ||
echo "current-context:" ${CURRENTCONTEXT} | ||
export KUBECONFIG="${HOME}/.kube/config" | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
GOPROXY=direct GOSUMDB=off GO111MODULE=on go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
FROM golang:1.14-stretch as bd | ||
ARG CONFIG_PROVIDER="viper" | ||
RUN apt update && apt install git libc-dev gcc pkgconf -y | ||
COPY ${PWD} /go/src/github.com/layer5io/meshery-nginx/ | ||
WORKDIR /go/src/github.com/layer5io/meshery-nginx/ | ||
RUN go build -ldflags="-w -s -X main.configProvider=$CONFIG_PROVIDER" -a -o meshery-nginx | ||
FROM golang:1.13 as builder | ||
|
||
FROM golang:1.14-stretch | ||
RUN apt update && apt install ca-certificates curl -y | ||
# Install kubectl | ||
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl" && \ | ||
chmod +x ./kubectl && \ | ||
mv ./kubectl /usr/local/bin/kubectl | ||
WORKDIR /build | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
# Copy the go source | ||
COPY main.go main.go | ||
COPY internal/ internal/ | ||
COPY nginx/ nginx/ | ||
# Build | ||
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o meshery-nginx main.go | ||
|
||
RUN mkdir /home/scripts/ && \ | ||
mkdir -p ${HOME}/.kube/ | ||
|
||
COPY --from=bd /go/src/github.com/layer5io/meshery-nginx/meshery-nginx /home/ | ||
COPY ${PWD}/scripts /home/scripts | ||
WORKDIR /home | ||
CMD ./meshery-nginx | ||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/base | ||
ENV DISTRO="debian" | ||
ENV GOARCH="amd64" | ||
WORKDIR /.meshery | ||
COPY bin/nginx-meshctl . | ||
WORKDIR / | ||
COPY --from=builder /build/meshery-nginx . | ||
ENTRYPOINT ["/meshery-nginx"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.