Skip to content

Commit

Permalink
Merge pull request #177 from swapnilgm/restructure-documentation
Browse files Browse the repository at this point in the history
Restructure the documentation
  • Loading branch information
shreyas-s-rao authored Aug 6, 2019
2 parents 7f39c47 + f620df1 commit a17381e
Show file tree
Hide file tree
Showing 13 changed files with 293 additions and 299 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
31 changes: 9 additions & 22 deletions .ci/integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,12 @@ VCS="github.com"
ORGANIZATION="gardener"
PROJECT="etcd-backup-restore"
REPOSITORY=${VCS}/${ORGANIZATION}/${PROJECT}
VERSION_FILE="$(readlink -f "${SOURCE_PATH}/VERSION")"
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 @@ -58,13 +45,13 @@ TEST_DIR=
function setup_test_enviornment() {
setup_ginkgo
setup_etcd
setup_etcbrctl
setup_etcdbrctl
setup_awscli
}

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 All @@ -82,9 +69,9 @@ function setup_etcd(){
echo "Successfully installed etcd."
}

function setup_etcbrctl(){
function setup_etcdbrctl(){
echo "Installing etcdbrctl..."
go build \
GO111MODULE=on go build \
-v \
-o ${GOBIN}/etcdbrctl \
-ldflags "-w -X ${REPOSITORY}/pkg/version.Version=${VERSION}" \
Expand Down Expand Up @@ -212,4 +199,4 @@ echo "Deleting test enviornment..."
cleanup_test_environment
echo "Successfully completed all tests."

exit $TEST_RESULT
exit $TEST_RESULT
21 changes: 3 additions & 18 deletions .ci/unit_test
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,10 @@ 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
GO111MODULE=off go get 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 a17381e

Please sign in to comment.