forked from openshift/cluster-version-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70cd664
commit ddeb140
Showing
8 changed files
with
172 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.swp | ||
bin/ | ||
.DS_Store | ||
_output |
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,8 +1,10 @@ | ||
FROM openshift/origin-release:golang-1.10 | ||
FROM golang:1.10.3 AS build-env | ||
|
||
COPY . /go/src/github.com/openshift/cluster-version-operator | ||
RUN cd /go/src/github.com/openshift/cluster-version-operator && \ | ||
make | ||
WORKDIR /go/src/github.com/openshift/cluster-version-operator | ||
RUN ./hack/build-go.sh | ||
|
||
FROM scratch | ||
COPY --from=build-env /go/src/github.com/openshift/cluster-version-operator/_output/linux/amd64/cluster-version-operator /bin/cluster-version-operator | ||
|
||
FROM centos:7 | ||
COPY --from=0 /go/src/github.com/openshift/cluster-version-operator/bin/cvo /usr/bin/ | ||
CMD /usr/bin/cvo | ||
ENTRYPOINT ["/bin/cluster-version-operator"] |
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,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
REPO=github.com/openshift/cluster-version-operator | ||
GOFLAGS=${GOFLAGS:-} | ||
GLDFLAGS=${GLDFLAGS:-} | ||
|
||
eval $(go env | grep -e "GOHOSTOS" -e "GOHOSTARCH") | ||
|
||
GOOS=${GOOS:-${GOHOSTOS}} | ||
GOARCH=${GOACH:-${GOHOSTARCH}} | ||
|
||
# Go to the root of the repo | ||
cd "$(git rev-parse --show-cdup)" | ||
|
||
if [ -z ${VERSION+a} ]; then | ||
echo "Using version from git..." | ||
VERSION=$(git describe --abbrev=8 --dirty --always) | ||
fi | ||
|
||
GLDFLAGS+="-X ${REPO}/pkg/version.Raw=${VERSION}" | ||
|
||
eval $(go env) | ||
|
||
if [ -z ${BIN_PATH+a} ]; then | ||
export BIN_PATH=_output/${GOOS}/${GOARCH} | ||
fi | ||
|
||
mkdir -p ${BIN_PATH} | ||
|
||
echo "Building ${REPO} (${VERSION})" | ||
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build ${GOFLAGS} -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/cluster-version-operator ${REPO}/cmd/... |
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,13 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script updates Go vendoring using dep. | ||
|
||
set -euo pipefail | ||
|
||
# Go to the root of the repo | ||
cd "$(git rev-parse --show-cdup)" | ||
|
||
# Run dep. | ||
dep ensure | ||
|
||
(cd hack && ./update-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
|
||
DIFFROOT="${SCRIPT_ROOT}/pkg" | ||
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" | ||
_tmp="${SCRIPT_ROOT}/_tmp" | ||
|
||
cleanup() { | ||
rm -rf "${_tmp}" | ||
} | ||
trap "cleanup" EXIT SIGINT | ||
|
||
cleanup | ||
|
||
mkdir -p "${TMP_DIFFROOT}" | ||
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" | ||
|
||
"${SCRIPT_ROOT}/hack/update-codegen.sh" | ||
echo "diffing ${DIFFROOT} against freshly generated codegen" | ||
ret=0 | ||
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? | ||
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" | ||
if [[ $ret -eq 0 ]] | ||
then | ||
echo "${DIFFROOT} up to date." | ||
else | ||
echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" | ||
exit 1 | ||
fi |
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,51 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script invokes tools that should be run prior to pushing | ||
# a repo, such as linters. This is designed to prevent running | ||
# CI on code that will have to be changed. | ||
|
||
set -uo pipefail | ||
|
||
if [[ ! $(which go) ]]; then | ||
echo "go not found on PATH. To install:" | ||
echo "https://golang.org/dl/" | ||
exit 1 | ||
fi | ||
if [[ ! $(which golint) ]]; then | ||
echo "golint not found on PATH. To install:" | ||
echo "go get -u github.com/golang/lint/golint" | ||
exit 1 | ||
fi | ||
if [[ ! $(which yamllint) ]]; then | ||
echo "yamllint not found on PATH. To install:" | ||
echo "https://github.com/adrienverge/yamllint" | ||
exit 1 | ||
fi | ||
|
||
rc=0 | ||
trap 'rc=$?' ERR | ||
|
||
# Go to the root of the repo | ||
cd "$(git rev-parse --show-cdup)" | ||
|
||
GOFILES=$(find . -path ./vendor -prune -o -name '*.go' | grep -v vendor) | ||
GOPKGS=$(go list ./... | grep -v '/vendor/' | grep -v '/generated/') | ||
|
||
echo "Running gofmt..." | ||
gofmt -s -d $GOFILES | ||
|
||
echo "Running go vet..." | ||
go vet $GOPKGS | ||
|
||
echo "Running golint..." | ||
golint -set_exit_status $GOPKGS | ||
|
||
echo "Running yamllint..." | ||
YAMLS=$(find . -path ./vendor -prune -o -name '*.yaml' | grep -v vendor) | ||
yamllint -c hack/yamllint-config.yaml -s $YAMLS | ||
|
||
echo "Running verify code-generators" | ||
(cd hack && ./verify-codegen.sh) | ||
|
||
echo "Done!" | ||
exit ${rc} |
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,31 @@ | ||
--- | ||
|
||
extends: default | ||
|
||
rules: | ||
braces: | ||
level: warning | ||
max-spaces-inside: 1 | ||
brackets: | ||
level: warning | ||
max-spaces-inside: 1 | ||
colons: | ||
level: warning | ||
commas: | ||
level: warning | ||
comments: disable | ||
comments-indentation: disable | ||
document-start: disable | ||
empty-lines: | ||
level: warning | ||
hyphens: | ||
level: warning | ||
indentation: | ||
level: warning | ||
indent-sequences: consistent | ||
line-length: disable | ||
truthy: disable | ||
|
||
ignore: | | ||
# The following have yaml-syntax-breaking templating, but are covered | ||
# by other yaml files in the unit tests. |