-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
- Loading branch information
Showing
18 changed files
with
117 additions
and
181 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,36 +1,55 @@ | ||
FROM golang:1.11 | ||
FROM teamserverless/license-check:0.3.9 as license-check | ||
|
||
RUN mkdir -p /go/src/github.com/openfaas-incubator/cron-connector/ | ||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.13 as build | ||
|
||
WORKDIR /go/src/github.com/openfaas-incubator/cron-connector | ||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ENV CGO_ENABLED=0 | ||
ENV GO111MODULE=on | ||
ENV GOFLAGS=-mod=vendor | ||
|
||
COPY --from=license-check /license-check /usr/bin/ | ||
|
||
WORKDIR /go/src/github.com/openfaas/cron-connector | ||
COPY . . | ||
|
||
ARG OPTS | ||
RUN license-check -path /go/src/github.com/openfaas/cron-connector/ --verbose=false "Alex Ellis" "OpenFaaS Author(s)" | ||
RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") | ||
RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test -v ./... | ||
|
||
RUN VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \ | ||
&& GIT_COMMIT=$(git rev-list -1 HEAD) \ | ||
&& GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=${CGO_ENABLED} go build \ | ||
--ldflags "-s -w \ | ||
-X github.com/openfaas/cron-connector/version.GitCommit=${GIT_COMMIT}\ | ||
-X github.com/openfaas/cron-connector/version.Version=${VERSION}" \ | ||
-a -installsuffix cgo -o cron-connector . | ||
|
||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.12 as ship | ||
LABEL org.label-schema.license="MIT" \ | ||
org.label-schema.vcs-url="https://github.com/openfaas/cron-connector" \ | ||
org.label-schema.vcs-type="Git" \ | ||
org.label-schema.name="openfaas/cron-connector" \ | ||
org.label-schema.vendor="openfaas" \ | ||
org.label-schema.docker.schema-version="1.0" | ||
|
||
RUN apk --no-cache add \ | ||
ca-certificates | ||
|
||
RUN gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") && \ | ||
go test -v ./ && \ | ||
VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') && \ | ||
GIT_COMMIT=$(git rev-list -1 HEAD) && \ | ||
env ${OPTS} CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \ | ||
-X github.com/openfaas-incubator/cron-connector/pkg/version.Release=${VERSION} \ | ||
-X github.com/openfaas-incubator/cron-connector/pkg/version.SHA=${GIT_COMMIT}" \ | ||
-a -installsuffix cgo -o cron-connector . && \ | ||
addgroup --system app && \ | ||
adduser --system --ingroup app app && \ | ||
mkdir /scratch-tmp | ||
RUN addgroup -S app \ | ||
&& adduser -S -g app app | ||
|
||
# we can't add user in next stage because it's from scratch | ||
# ca-certificates and tmp folder are also missing in scratch | ||
# so we add all of it here and copy files in next stage | ||
WORKDIR /home/app | ||
|
||
FROM scratch | ||
ENV http_proxy "" | ||
ENV https_proxy "" | ||
|
||
COPY --from=0 /etc/passwd /etc/group /etc/ | ||
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=0 --chown=app:app /scratch-tmp /tmp/ | ||
COPY --from=0 /go/src/github.com/openfaas-incubator/cron-connector/cron-connector . | ||
COPY --from=build /go/src/github.com/openfaas/cron-connector/cron-connector . | ||
RUN chown -R app:app ./ | ||
|
||
USER app | ||
|
||
ENTRYPOINT ["./cron-connector"] | ||
CMD ["./cron-connector"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -26,6 +26,3 @@ manifest: | |
|
||
test: | ||
go test ./... | ||
|
||
verify-codegen: | ||
./hack/verify-codegen.sh |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module github.com/openfaas/cron-connector | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/ewilde/faas-federation v0.0.0-20200206161705-23d8f6d639f1 // indirect | ||
github.com/openfaas-incubator/connector-sdk v0.0.0-20190125151851-d722c9f72ad0 | ||
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6 | ||
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d // indirect | ||
github.com/pkg/errors v0.8.1 | ||
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 | ||
) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
github.com/ewilde/faas-federation v0.0.0-20200206161705-23d8f6d639f1/go.mod h1:KUZSQ/D7+BBykfBCx2cPn8LZdvRLPHwBLhKxF94jRWw= | ||
github.com/openfaas-incubator/connector-sdk v0.0.0-20190125151851-d722c9f72ad0 h1:K7UydMie+pPYUtyA/Ele4xMst5q2D8yYPNg5NU2cs3U= | ||
github.com/openfaas-incubator/connector-sdk v0.0.0-20190125151851-d722c9f72ad0/go.mod h1:jHCtd1HCZwhuwdPy4OB8CQU7ZqzxBdWNhIhH/khCJqQ= | ||
github.com/openfaas/cron-connector v0.2.2/go.mod h1:G+g/i/KXbkd3A/W0FogoRnGxG0uOOhOkshPhuWWdUnQ= | ||
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6 h1:eCf/7VwjpIOfLecWQoO0W9UMu1g5g9Ocwp+Sg7jkGzg= | ||
github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6/go.mod h1:E0m2rLup0Vvxg53BKxGgaYAGcZa3Xl+vvL7vSi5yQ14= | ||
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d h1:mPAUhyVGlBfGVQQUngtyGEH9uidFUzq9R5QkrpqGJug= | ||
github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d/go.mod h1:W4OIp33RUOpR7wW+omJB/7GhIydRmYXvKf/VqUKI4yM= | ||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 h1:E846t8CnR+lv5nE+VuiKTDG/v1U2stad0QzddfJC7kY= | ||
gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5/go.mod h1:hiOFpYm0ZJbusNj2ywpbrXowU3G8U6GIQzqn2mw1UIE= |
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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# github.com/openfaas-incubator/connector-sdk v0.0.0-20190125151851-d722c9f72ad0 | ||
github.com/openfaas-incubator/connector-sdk/types | ||
# github.com/openfaas/faas v0.0.0-20190104165101-a65df4795bc6 | ||
github.com/openfaas/faas/gateway/requests | ||
# github.com/openfaas/faas-provider v0.0.0-20181216160432-220324e98f5d | ||
github.com/openfaas/faas-provider/auth | ||
# github.com/pkg/errors v0.8.1 | ||
github.com/pkg/errors | ||
# gopkg.in/robfig/cron.v2 v2.0.0-20150107220207-be2e0b0deed5 | ||
gopkg.in/robfig/cron.v2 |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2020 OpenFaaS Author(s) | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
package version | ||
|
||
var ( | ||
// Version release version of the provider | ||
Version string | ||
|
||
// GitCommit SHA of the last git commit | ||
GitCommit string | ||
|
||
// DevVersion string for the development version | ||
DevVersion = "dev" | ||
) | ||
|
||
// BuildVersion returns current version of the provider | ||
func BuildVersion() string { | ||
if len(Version) == 0 { | ||
return DevVersion | ||
} | ||
return Version | ||
} | ||
|
||
// GetReleaseInfo includes the SHA and the release version | ||
func GetReleaseInfo() (sha, release string) { | ||
return GitCommit, BuildVersion() | ||
} |