Skip to content

Commit

Permalink
🏃 remove git-lfs usage
Browse files Browse the repository at this point in the history
We no longer use git-lfs due to bandwidth quota issues. This
removes git-lfs usage from test scripts.
  • Loading branch information
droot committed Jun 18, 2019
1 parent 88c65c8 commit c92f36e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 35 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
testdata/*.tgz filter=lfs diff=lfs merge=lfs -text
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go:

git:
depth: 3
lfs_skip_smudge: true

go_import_path: sigs.k8s.io/kubebuilder

Expand All @@ -23,12 +22,9 @@ services:

before_install:
- go get -u github.com/golang/dep/cmd/dep
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -sL https://github.com/git-lfs/git-lfs/releases/download/v2.7.2/git-lfs-darwin-amd64-v2.7.2.tar.gz | tar -xz git-lfs; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GO111MODULE=on scripts/install_and_setup.sh; fi

before_script:
- git lfs install
- git lfs pull

# Install must be set to prevent default `go get` to run.
# The dependencies have already been vendored by `dep` so
Expand Down
7 changes: 1 addition & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Kubernetes projects require that you sign a Contributor License Agreement (CLA)
Please see https://git.k8s.io/community/CLA.md for more info.

## Contributing steps
1. Setup [Git LFS plugin](https://git-lfs.github.com/)
1. Submit an issue describing your proposed change to the repo in question.
1. The [repo owners](OWNERS) will respond to your issue promptly.
1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above).
Expand All @@ -16,13 +15,9 @@ Please see https://git.k8s.io/community/CLA.md for more info.

## How to build kubebuilder locally

1. Setup Git LFS
Install the git-lfs plugin using the instructions from [git-lfs](https://git-lfs.github.com/) page.
Once installed, run `git lfs install` in your repo to setup git lfs hooks.

1. Build
```sh
$ go build -o /output/path/kubebuilder ./cmd
$ make build
```

1. Test
Expand Down
15 changes: 14 additions & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,22 @@ function setup_envs {
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
}

# download_vendor_archive downloads vendor tarball for v1 projects. It skips the
# download if tarball exists.
function download_vendor_archive {
archive_name="vendor.v1.tgz"
archive_download_url="https://storage.googleapis.com/kubebuilder-vendor/$archive_name"
archive_path="$tmp_root/$archive_name"
if [ ! -f $archive_path ]; then
header_text "downloading vendor archive $archive_path"
curl -sL ${archive_download_url} -o "$archive_path"
fi
}

function restore_go_deps {
header_text "restoring Go dependencies"
tar -zxf ${go_workspace}/src/sigs.k8s.io/kubebuilder/testdata/vendor.v1.tgz
download_vendor_archive
tar -zxf $tmp_root/vendor.v1.tgz
}

function cache_project {
Expand Down
9 changes: 2 additions & 7 deletions generated_golden.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ scaffold_test_project() {
export GO111MODULE=auto
export GOPATH=$(pwd)/../.. # go ignores vendor under testdata, so fake out a gopath
# untar Gopkg.lock and vendor directory for appropriate project version
tar -zxf $testdata_dir/vendor.v$version.tgz
download_vendor_archive
tar -zxf $tmp_root/vendor.v$version.tgz

$kb init --project-version $version --domain testproject.org --license apache2 --owner "The Kubernetes authors" --dep=false
$kb create api --group crew --version v1 --kind FirstMate --controller=true --resource=true --make=false
Expand Down Expand Up @@ -80,12 +81,6 @@ scaffold_test_project() {

set -e

if ! git lfs > /dev/null 2>&1 ; then
echo "this project requires git-lfs, see: https://git-lfs.github.com/"
echo "after installing, you'll need to git checkout ./testdata/*tgz"
exit 1
fi

build_kb
scaffold_test_project gopath/src/project 1
scaffold_test_project project-v2 2
11 changes: 0 additions & 11 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,6 @@ y
EOF
}

# download_vendor_archive downloads vendor tarball for v1 projects. It skips the
# download if tarball exists.
function download_vendor_archive {
archive_name="vendor.v1.tgz"
archive_download_url="https://storage.googleapis.com/kubebuilder-vendor/$archive_name"
archive_path="$tmp_root/$archive_name"
if [ ! -f $archive_path ]; then
header_text "downloading vendor archive $archive_path"
curl -sL ${archive_download_url} -o "$archive_path"
fi
}

function test_project {
project_dir=$1
Expand Down
11 changes: 9 additions & 2 deletions test/e2e/e2e_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ var _ = Describe("kubebuilder", func() {

It("should generate a runnable project", func() {
// prepare v1 vendor
By("untar the vendor tarball")
cmd := exec.Command("tar", "-zxf", "../../../testdata/vendor.v1.tgz")
By("downloading the vendor tarball")
cmd := exec.Command("wget",
"https://storage.googleapis.com/kubebuilder-vendor/vendor.v1.tgz",
"-O", "/tmp/vendor.v1.tgz")
_, err := kbc.Run(cmd)
Expect(err).Should(Succeed())

By("untar the vendor tarball")
cmd = exec.Command("tar", "-zxf", "/tmp/vendor.v1.tgz")
_, err = kbc.Run(cmd)
Expect(err).Should(Succeed())

var controllerPodName string

By("init v1 project")
Expand Down
3 changes: 0 additions & 3 deletions testdata/vendor.v1.tgz

This file was deleted.

0 comments on commit c92f36e

Please sign in to comment.