Skip to content

Commit

Permalink
consolidating and expanding examples
Browse files Browse the repository at this point in the history
  • Loading branch information
robscott committed Dec 4, 2018
1 parent a03b8c6 commit 6958a92
Show file tree
Hide file tree
Showing 39 changed files with 197 additions and 224 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ We currently include a variety of CI Images, including Alpine and Debian Stretch

The latest Debian Stretch release can be pulled from `quay.io/reactiveops/ci-images:v7-stretch`. A full list of the latest image tags is available on our [Quay repository](https://quay.io/repository/reactiveops/ci-images).

## Examples

rok8s-scripts is designed to work well in a wide variety of environments. That includes Bitbucket Pipelines, CircleCI, GitLab CI, and more. There are many valid ways to configure CI pipelines, we've includes a variety of [examples](/examples) in this repository.

Most notably, the CI example includes sample configuration for the following platforms:

- [Bitbucket Pipelines](/examples/ci/bitbucket-pipelines.yml)
- [CircleCI](/examples/ci/.circleci/config.yml)
- [GitLab CI](/examples/ci/.gitlab-ci.yml)
- [Jenkins](/examples/ci/Jenkinsfile)

On their own, these examples may not make a lot of sense. There's a lot more documentation below that should cover everything included in these examples and more.

## Further Reading

- [Building and Pushing Docker Images](/docs/docker.md)
Expand Down
19 changes: 14 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ We currently include a variety of CI Images, including Alpine and Debian Stretch

The latest Debian Stretch release can be pulled from `quay.io/reactiveops/ci-images:v7-stretch`. A full list of the latest image tags is available on our [Quay repository](https://quay.io/repository/reactiveops/ci-images).

## Examples

rok8s-scripts is designed to work well in a wide variety of environments. That includes Bitbucket Pipelines, CircleCI, GitLab CI, and more. There are many valid ways to configure CI pipelines, we've includes a variety of [examples](/examples) in this repository.

Most notably, the CI example includes sample configuration for the following platforms:

- [Bitbucket Pipelines](/examples/ci/bitbucket-pipelines.yml)
- [CircleCI](/examples/ci/.circleci/config.yml)
- [GitLab CI](/examples/ci/.gitlab-ci.yml)
- [Jenkins](/examples/ci/Jenkinsfile)

On their own, these examples may not make a lot of sense. There's a lot more documentation below that should cover everything included in these examples and more.

## Further Reading

- [Building and Pushing Docker Images](/docs/docker.md)
- [Deploying to Kubernetes with Helm](/docs/helm.md)
- [Deploying to Kubernetes without Helm](/docs/without_helm.md)
Expand All @@ -26,11 +40,6 @@ The latest Debian Stretch release can be pulled from `quay.io/reactiveops/ci-ima
- [Amazon Web Services](/docs/aws.md)
- [Google Cloud](/docs/gcp.md)

### CI Specific Documentation
- CircleCI
- GitLab CI
- Bitbucket Pipelines

### Contributing
- [Releasing New Versions of rok8s-scripts](/docs/releasing.md)

Expand Down
4 changes: 4 additions & 0 deletions docs/without_helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ k8s-deploy-and-verify -f deploy/development.config

More indepth examples are available in the [examples directory](/examples).

## Versioning
**If a Docker image is used in the file then any cases of `:latest` will be replaced with th `CI_SHA1` if it is defined.** This allows a set image tag to be used when deploying from a CI system. When files that could use `CI_SHA1` are deployed, a new file will be created with that value as part of the filename.

If using an HPA, set `replicas: hpa` in the deployment file to have k8s-deploy get the current number of replicas from the cluster and deploy that number of replicas. This is a workaround for an open issue (https://github.com/kubernetes/kubernetes/issues/25238).

## Deployment Configuration
Listed below are all the types of resources rok8s-scripts supports. In all cases, the filename suffix is important and must match the spec precisely.
Expand Down
1 change: 0 additions & 1 deletion examples/Jenkins-K8s-Plugin/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions examples/Jenkins-K8s-Plugin/charts/example/.helmignore

This file was deleted.

3 changes: 0 additions & 3 deletions examples/Jenkins-K8s-Plugin/charts/example/Chart.yaml

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions examples/Jenkins-K8s-Plugin/charts/example/templates/_helpers.tpl

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

26 changes: 0 additions & 26 deletions examples/Jenkins-K8s-Plugin/charts/example/templates/service.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions examples/Jenkins-K8s-Plugin/charts/example/values.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions examples/Jenkins-K8s-Plugin/deploy/development.config

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions examples/Jenkins-K8s-Plugin/deploy/production.config

This file was deleted.

10 changes: 0 additions & 10 deletions examples/Jenkins-K8s-Plugin/deploy/production/example.values.yml

This file was deleted.

11 changes: 0 additions & 11 deletions examples/Jenkins-K8s-Plugin/deploy/staging.config

This file was deleted.

10 changes: 0 additions & 10 deletions examples/Jenkins-K8s-Plugin/deploy/staging/example.values.yml

This file was deleted.

File renamed without changes.
78 changes: 78 additions & 0 deletions examples/ci/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
stages:
- build
- deploy

variables:
GCLOUDSDK_CONTAINER_USE_V1_CLIENT: "false"
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcloud_key.json
GCP_REGION: us-west1
CI_SHA1: $CI_COMMIT_SHA
CI_BRANCH: $CI_COMMIT_REF_NAME
CI_BUILD_NUM: $CI_JOB_ID
CI_TAG: $CI_COMMIT_TAG
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2

image: quay.io/reactiveops/ci-images:v7-alpine
services:
- docker:dind

.aliases:
- &initialize-dev |
export GCP_PROJECT=sample-dev-project
export CLUSTER_NAME=sample-dev-cluster
export GCLOUD_KEY=$GCLOUD_KEY_DEV
export ROK8S_CONFIG="deploy/development.config"
prepare-gcloud

- &initialize-staging |
export GCP_PROJECT=sample-staging-project
export CLUSTER_NAME=sample-staging-cluster
export GCLOUD_KEY=$GCLOUD_KEY_STAGING
export ROK8S_CONFIG="deploy/staging.config"
prepare-gcloud

- &initialize-prod |
export GCP_PROJECT=sample-staging-project
export CLUSTER_NAME=sample-staging-cluster
export GCLOUD_KEY=$GCLOUD_KEY_PROD
export ROK8S_CONFIG="deploy/production.config"
prepare-gcloud

build:
stage: build
script:
- *initialize-dev
- docker-build -f $ROK8S_CONFIG
- docker-push -f $ROK8S_CONFIG

deploy_development:
stage: deploy
environment:
name: development
script:
- *initialize-dev
- helm-deploy -f $ROK8S_CONFIG
only:
- /^dev-.*/

deploy_staging:
stage: deploy
environment:
name: staging
script:
- *initialize-staging
- helm-deploy -f $ROK8S_CONFIG
only:
- master

deploy_production:
stage: deploy
environment:
name: production
script:
- *initialize-prod
- helm-deploy -f $ROK8S_CONFIG
only:
- /^v.*/
when: manual
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6958a92

Please sign in to comment.