Skip to content

Commit

Permalink
Simplify installation process
Browse files Browse the repository at this point in the history
- Deploy the quay.io images produced by Travis by default.
- Add `make install` targets:
  - Rename `crd.sh` to `shipwright-build.sh`.
  - Add subcommands to install only the apis, sample strategies, and the
    controllers.
  - Add install targets to the Makefile
- Update README to improve getting started experience:
  - Add instructions to create a namespace to run the builds
  - Command line instructions to install Tekton and Shipwright Builds
  - Set up push secret prior to running example build
  - Switch example to use buildpacks instead of Kaniko
- Update make commands used to run CI tests.
  • Loading branch information
adambkaplan committed Oct 8, 2020
1 parent 5b7de61 commit f44242a
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 154 deletions.
6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ The following set of steps highlight how to deploy a Build operator pod into an

```sh
pushd $GOPATH/src/github.com/shipwright-io/build
./hack/crd.sh install
./hack/shipwright-build.sh install
popd
```

Expand All @@ -157,7 +157,7 @@ As you make changes to the code, you can redeploy your operator with:

```sh
pushd $GOPATH/src/github.com/shipwright-io/build
./hack/crd.sh install
./hack/shipwright-build.sh install
popd
```

Expand All @@ -167,7 +167,7 @@ You can clean up everything with:

```sh
pushd $GOPATH/src/github.com/shipwright-io/build
./hack/crd.sh uninstall
./hack/shipwright-build.sh uninstall
popd
```

Expand Down
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ test-unit-coverage: test-unit

# Based on https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/integration-tests.md
.PHONY: test-integration
test-integration: crds
test-integration: install-apis
GO111MODULE=on ginkgo \
-randomizeAllSpecs \
-randomizeSuites \
Expand All @@ -155,7 +155,7 @@ test-integration: crds


.PHONY: test-e2e
test-e2e: crds-and-resources test-e2e-plain
test-e2e: install-strategies test-e2e-plain

.PHONY: test-e2e-plain
test-e2e-plain:
Expand All @@ -169,15 +169,21 @@ test-e2e-plain:
TEST_E2E_VERIFY_TEKTONOBJECTS=${TEST_E2E_VERIFY_TEKTONOBJECTS} \
ginkgo ${TEST_E2E_FLAGS} test/e2e

crds-and-resources:
-hack/crds-and-resources.sh uninstall
@hack/crds-and-resources.sh install
.PHONY: install install-apis install-operator install-strategies

crds:
-hack/crds.sh uninstall
@hack/crds.sh install
install:
@hack/shipwright-build.sh install

local: crds-and-resources build
install-apis:
@hack/shipwright-build.sh install apis

install-operator: install-apis
@hack/shipwright-build.sh install controllers

install-strategies: install-apis
@hack/shipwright-build.sh install strategies

local: install-strategies build
OPERATOR_NAME=build-operator \
operator-sdk run --local --operator-flags="$(ZAP_FLAGS)"

Expand Down
64 changes: 46 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,43 +70,71 @@ Examples of `Build` resource using the example strategies shipped with this oper
## Try it!

* Get a [Kubernetes](https://kubernetes.io/) cluster and [`kubectl`](https://kubernetes.io/docs/reference/kubectl/overview/) set up to connect to your cluster.
* Install [Tekton](https://cloud.google.com/tekton) by running [install-tekton.sh](hack/install-tekton.sh), it installs v0.14.2.
* Install [operator-sdk][operatorsdk] by running [install-operator-sdk.sh](hack/install-operator-sdk.sh), it installs v0.17.0.
* Create a namespace called **build-examples** by running `kubectl create namespace build-examples`.
* Execute `make local` to register [well-known build strategies](samples/buildstrategy) including **Kaniko** and start the operator locally.
* Create a [Kaniko](samples/build/build_kaniko_cr.yaml) build.
* Clone this repository from GitHub:

```bash
$ git clone https://github.com/shipwright-io/build.git
...
$ cd build/
```

* Install [Tekton](https://cloud.google.com/tekton) by running [hack/install-tekton.sh](hack/install-tekton.sh), it installs v0.14.2.

```bash
$ hack/install-tekton.sh
```

* Install the operator and sample strategies via `make`:

```bash
$ make install
```

* Add a push secret to your container image repository, such as one on Docker Hub or quay.io:

```yaml
$ kubectl create secret generic push-secret \
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
```

* Create a [Cloud Native Buildpacks](samples/build/build_buildpacks_v3_cr.yaml) build, replacing
`<MY_REGISTRY>/<MY_USERNAME>/<MY_REPO>` with the registry hostname, username, and repository your
cluster has access to and that you have permission to push images to.

```bash
$ kubectl apply -f - <<EOF
apiVersion: build.dev/v1alpha1
kind: Build
metadata:
name: kaniko-golang-build
namespace: build-examples
name: buildpack-nodejs-build
spec:
source:
url: https://github.com/sbose78/taxi
contextDir: .
url: https://github.com/adambkaplan/shipwright-example-nodejs.git
strategy:
name: kaniko
name: buildpacks-v3
kind: ClusterBuildStrategy
dockerfile: Dockerfile
output:
image: image-registry.openshift-image-registry.svc:5000/build-examples/taxi-app
image: <MY_REGISTRY>/<MY_USERNAME>/<MY_REPO>:latest
credentials:
name: push-secret
EOF
```

* Start a [Kaniko](samples/buildrun/buildrun_kaniko_cr.yaml) buildrun
* Run your build:

```yaml
```bash
$ kubectl apply -f - <<EOF
apiVersion: build.dev/v1alpha1
kind: BuildRun
metadata:
name: kaniko-golang-buildrun
namespace: build-examples
name: buildpack-nodejs-build-1
spec:
buildRef:
name: kaniko-golang-build
name: buildpack-nodejs-build
serviceAccount:
generate: true
name: default
EOF
```

## Roadmap
Expand Down
3 changes: 1 addition & 2 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ spec:
serviceAccountName: build-operator
containers:
- name: build-operator
# Replace this with the built image name
image: REPLACE_IMAGE
image: quay.io/shipwright/shipwright-operator:latest
command:
- build-operator
imagePullPolicy: Always
Expand Down
67 changes: 0 additions & 67 deletions hack/crds-and-resources.sh

This file was deleted.

55 changes: 0 additions & 55 deletions hack/crds.sh

This file was deleted.

Loading

0 comments on commit f44242a

Please sign in to comment.