Skip to content

Commit

Permalink
Restructure the documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Swapnil Mhamane <[email protected]>
  • Loading branch information
Swapnil Mhamane committed Jul 22, 2019
1 parent 12c986c commit 52203f2
Show file tree
Hide file tree
Showing 16 changed files with 232 additions and 287 deletions.
20 changes: 4 additions & 16 deletions .ci/build
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,9 @@ VCS="github.com"
ORGANIZATION="gardener"
PROJECT="etcd-backup-restore"
REPOSITORY=${VCS}/${ORGANIZATION}/${PROJECT}
export GO111MODULE=on
cd "${SOURCE_PATH}"

# The `go <cmd>` commands requires to see the target repository to be part of a
# Go workspace. Thus, if we are not yet in a Go workspace, let's create one
# temporarily by using symbolic links.
if [[ "${SOURCE_PATH}" != *"src/${REPOSITORY}" ]]; then
SOURCE_SYMLINK_PATH="${SOURCE_PATH}/tmp/src/${REPOSITORY}"
if [[ -d "${SOURCE_PATH}/tmp" ]]; then
rm -rf "${SOURCE_PATH}/tmp"
fi
mkdir -p "${SOURCE_PATH}/tmp/src/${VCS}/${ORGANIZATION}"
ln -s "${SOURCE_PATH}" "${SOURCE_SYMLINK_PATH}"
cd "${SOURCE_SYMLINK_PATH}"

export GOPATH="${SOURCE_PATH}/tmp"
export GOBIN="${SOURCE_PATH}/tmp/bin"
export PATH="${GOBIN}:${PATH}"
fi

###############################################################################

Expand All @@ -63,6 +49,7 @@ GIT_SHA=$(git rev-parse --short HEAD || echo "GitNotFound")
if [[ -z "$LOCAL_BUILD" ]]; then
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-a \
-mod vendor \
-v \
-o ${BINARY_PATH}/linux-amd64/etcdbrctl \
-ldflags "-w -X ${REPOSITORY}/pkg/version.Version=${VERSION} -X ${REPOSITORY}/pkg/version.GitSHA=${GIT_SHA}" \
Expand All @@ -72,6 +59,7 @@ if [[ -z "$LOCAL_BUILD" ]]; then
else
go build \
-v \
-mod vendor \
-o ${BINARY_PATH}/etcdbrctl \
-ldflags "-w -X ${REPOSITORY}/pkg/version.Version=${VERSION} -X ${REPOSITORY}/pkg/version.GitSHA=${GIT_SHA}" \
main.go
Expand Down
24 changes: 4 additions & 20 deletions .ci/check
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,10 @@ VCS="github.com"
ORGANIZATION="gardener"
PROJECT="etcd-backup-restore"
REPOSITORY=${VCS}/${ORGANIZATION}/${PROJECT}

# The `go <cmd>` commands requires to see the target repository to be part of a
# Go workspace. Thus, if we are not yet in a Go workspace, let's create one
# temporarily by using symbolic links.
if [[ "${SOURCE_PATH}" != *"src/${REPOSITORY}" ]]; then
SOURCE_SYMLINK_PATH="${SOURCE_PATH}/tmp/src/${REPOSITORY}"
if [[ -d "${SOURCE_PATH}/tmp" ]]; then
rm -rf "${SOURCE_PATH}/tmp"
fi
mkdir -p "${SOURCE_PATH}/tmp/src/${VCS}/${ORGANIZATION}"
ln -s "${SOURCE_PATH}" "${SOURCE_SYMLINK_PATH}"
cd "${SOURCE_SYMLINK_PATH}"

export GOPATH="${SOURCE_PATH}/tmp"
export GOBIN="${SOURCE_PATH}/tmp/bin"
export PATH="${GOBIN}:${PATH}"
fi
cd "${SOURCE_PATH}"

# Install Golint (linting tool).
go get -u golang.org/x/lint/golint
GO111MODULE=off go get -u golang.org/x/lint/golint

# Install Helm from binary.
curl -LO https://git.io/get_helm.sh
Expand All @@ -56,12 +40,12 @@ rm get_helm.sh

###############################################################################

PACKAGES="$(go list -e ./... | grep -vE '/tmp/|/vendor/')"
PACKAGES="$(GO111MODULE=on go list -mod=vendor -e ./...)"
LINT_FOLDERS="$(echo ${PACKAGES} | sed "s|github.com/gardener/etcd-backup-restore|.|g")"
HELM_CHART_PATH="${SOURCE_PATH}/chart/etcd-backup-restore"

# Execute static code checks.
go vet ${PACKAGES}
GO111MODULE=on go vet -mod vendor ${PACKAGES}

# Execute automatic code formatting directive.
go fmt ${PACKAGES}
Expand Down
21 changes: 4 additions & 17 deletions .ci/integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,9 @@ REPOSITORY=${VCS}/${ORGANIZATION}/${PROJECT}
VERSION_FILE="$(readlink -f "${SOURCE_PATH}/VERSION")"
VERSION="$(cat "${VERSION_FILE}")"

# The `go <cmd>` commands requires to see the target repository to be part of a
# Go workspace. Thus, if we are not yet in a Go workspace, let's create one
# temporarily by using symbolic links.
if [[ "${SOURCE_PATH}" != *"src/${REPOSITORY}" ]]; then
SOURCE_SYMLINK_PATH="${SOURCE_PATH}/tmp/src/${REPOSITORY}"
if [[ -d "${SOURCE_PATH}/tmp" ]]; then
rm -rf "${SOURCE_PATH}/tmp"
fi
mkdir -p "${SOURCE_PATH}/tmp/src/${VCS}/${ORGANIZATION}"
ln -s "${SOURCE_PATH}" "${SOURCE_SYMLINK_PATH}"
cd "${SOURCE_SYMLINK_PATH}"

export GOPATH="${SOURCE_PATH}/tmp"
export GOBIN="${SOURCE_PATH}/tmp/bin"
export PATH="${GOBIN}:${PATH}"
fi
export GOBIN="${SOURCE_PATH}/bin"
export PATH="${GOBIN}:${PATH}"
cd "${SOURCE_PATH}"

##############################################################################

Expand All @@ -64,7 +51,7 @@ function setup_test_enviornment() {

function setup_ginkgo(){
echo "Installing Ginkgo..."
go get -u github.com/onsi/ginkgo/ginkgo
GO111MODULE=off go get -u github.com/onsi/ginkgo/ginkgo
echo "Successfully installed Ginkgo."
}

Expand Down
19 changes: 2 additions & 17 deletions .ci/unit_test
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,7 @@ ORGANIZATION="gardener"
PROJECT="etcd-backup-restore"
REPOSITORY=${VCS}/${ORGANIZATION}/${PROJECT}

# The `go <cmd>` commands requires to see the target repository to be part of a
# Go workspace. Thus, if we are not yet in a Go workspace, let's create one
# temporarily by using symbolic links.
if [[ "${SOURCE_PATH}" != *"src/${REPOSITORY}" ]]; then
SOURCE_SYMLINK_PATH="${SOURCE_PATH}/tmp/src/${REPOSITORY}"
if [[ -d "${SOURCE_PATH}/tmp" ]]; then
rm -rf "${SOURCE_PATH}/tmp"
fi
mkdir -p "${SOURCE_PATH}/tmp/src/${VCS}/${ORGANIZATION}"
ln -s "${SOURCE_PATH}" "${SOURCE_SYMLINK_PATH}"
cd "${SOURCE_SYMLINK_PATH}"

export GOPATH="${SOURCE_PATH}/tmp"
export GOBIN="${SOURCE_PATH}/tmp/bin"
export PATH="${GOBIN}:${PATH}"
fi
cd "${SOURCE_PATH}"

# Install Ginkgo (test framework) to be able to execute the tests.
go get -u github.com/onsi/ginkgo/ginkgo
Expand All @@ -57,7 +42,7 @@ function test_with_coverage() {
ginkgo $GINKGO_COMMON_FLAGS --coverprofile ${coverprofile_file} -covermode=set -outputdir ${output_dir} ${TEST_PACKAGES}
sed -i '/mode: set/d' ${output_dir}/${coverprofile_file}
{( echo "mode: set"; cat ${output_dir}/${coverprofile_file} )} > ${output_dir}/${coverprofile_file}.temp
mv ${output_dir}/${coverprofile_file}.temp ${output_dir}/${coverprofile_file}
mv ${output_dir}/${coverprofile_file}.temp ${output_dir}/${coverprofile_file}
go tool cover -func ${output_dir}/${coverprofile_file}
}

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ revendor:
@env GO111MODULE=on go mod vendor -v
@env GO111MODULE=on go mod tidy -v

.PHONY: update-dependencies
update-dependencies:
@env GO111MODULE=on go get -u

.PHONY: build
build:
@.ci/build
Expand Down
Loading

0 comments on commit 52203f2

Please sign in to comment.