diff --git a/.circleci/config.yml b/.circleci/config.yml index 7173c6c5..8a00d8f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,14 +40,6 @@ references: echo "Skipping the docker push because '\$DOCKER_BASE_TAG: $DOCKER_BASE_TAG' does not start with dev- or v[0-9]+." fi - npm_release: &npm_release - run: - name: NPM release - command: | - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - echo $CIRCLE_TAG | xargs npm version --no-git-tag-version - npm publish - github_release: &github_release run: name: GitHub release @@ -99,7 +91,6 @@ jobs: - *docker_login - *docker_build - *docker_push - - *npm_release workflows: diff --git a/.gitignore b/.gitignore index 325cb301..a0f0e538 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -package-lock.json -*egg-info .vscode .DS_Store diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..004e5960 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# How to contribute + +Issues, whether bugs, tasks, or feature requests are essential for keeping rok8s-scripts (and ReactiveOps in general) great. +We believe it should be as easy as possible to contribute changes that +get things working in your environment. There are a few guidelines that we +need contributors to follow so that we can have a chance of keeping on +top of things. + +## Getting Started + +* Submit an issue, assuming one does not already exist. + * Clearly describe the issue including steps to reproduce when it is a bug. + * Apply the appropriate labels, whether it is bug, feature, or task. + +## Making Changes + +* Create a feature branch from where you want to base your work. + * This is usually the master branch. + * To quickly create a topic branch based on master; `git checkout -b + feature master`. Please avoid working directly on the + `master` branch. +* Try to make commits of logical units. +* Make sure you have added the necessary tests for your changes if applicable. +* Make sure you have added any required documentation changes. + +## Making Trivial Changes + +### Documentation + +For changes of a trivial nature to comments and documentation, it is not +always necessary to create a new issue in GitHub. In these cases, a branch with pull request is sufficient. + +## Submitting Changes + +* Push your changes to a topic branch. +* Submit a pull request. +* Mention the issue in your PR description. I.E. `Fixes #42`. This will ensure that your issue gets tagged with the PR. + + +Attribution +=========== +Portions of this text are copied from the [Puppet Contributing](https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md) documentation. diff --git a/DESIGN.md b/DESIGN.md new file mode 100644 index 00000000..fe6b6ff5 --- /dev/null +++ b/DESIGN.md @@ -0,0 +1,21 @@ +# rok8s-scripts Design Doc + +## Introduction + +This is a set of opinionated scripts for managing application development and deployment lifecycle using Kubernetes. These simplify secure secrets management, environment specific config, Docker build caching, and much more. The opinionated nature of the scripts reflects the collective experience and observed best-practices that ReactiveOps has accumulated. + +## Guiding Principles + +There are several things that are to be kept in mind while maintaining rok8s-scripts.. They should act as baseline from which to make decisions. + +**Ease of Use** +It should be relatively trivial to take an existing Dockerized application and construct a pipleline to build and deploy it using rok8s-scripts. + +**Backward Compatibility** +When introducing a new feature to rok8s-scripts, it should be backward-compatible. If it might break something, we prefer to contain it inside of an environment variable feature flag in order to make the feature optional. If this is not possible, sufficient care should be taken to notify customers and increment version accordingly. + +**Scope** +As maintainers of rok8s-scripts, ReactiveOps is not in the business of catering to every single hand-crafted bespoke pipeline in existence. This means that some changes may be out of scope for the intended purpose. The intended purpose is to build, push, and deploy containers. + +**Pull Requests Welcom** +Please don't hesistate to reach out and file a PR or an Issue if you would like to see something implemented. See [CONTRIBUTING](CONTRIBUTING.md) diff --git a/LICENSE.k8s b/LICENSE similarity index 100% rename from LICENSE.k8s rename to LICENSE diff --git a/README.md b/README.md index 56c6359c..45c3f47f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Each new release of rok8s-scripts comes with a new set of CI images for simple w We currently include a variety of CI Images, including Alpine and Debian Stretch as our recommended starting points. In certain cases you may want to use our images that include Node.js or Golang. -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). +The latest Debian Stretch release can be pulled from `quay.io/reactiveops/ci-images:v8-stretch`. A full list of the latest image tags is available on our [Quay repository](https://quay.io/repository/reactiveops/ci-images). ## Examples @@ -25,11 +25,31 @@ Most notably, the CI example includes sample configuration for the following pla 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. +## Versioning v8.0.0 and beyond + +Rok8s-scripts contains a number of dependencies that have various ways of versioning themselves. Most notably, Helm tends to break backward compatibility with every minor release. We have decided that post v8 of rok8s-scripts, we will update our versions according to the version change of the underlying tool. For example, if Helm changes from `2.13.0` to `2.14.0`, we will change the version of rok8s scripts by one minor version. This will be clearly mentioned in the release notes. This means that a minor version of rok8s-scripts could introduce breaking changes to the CI/CD pipelines that are using it. + +Please note that we will still commit to any patch version releases being backward-compatible. We will never release a patch version that upgrades an underlying tool beyond a patch version, and we will not release any patch versions of rok8s-scripts that introduce a breaking change. + +Here is a set of guidelines to follow when deciding what version of ci-images (and thus rok8s-scripts) to use: + +#### You are very risk-averse + +You want rok8s-scripts to be stable, and just keep working until you decide to upgrade. + +In this scenario, you should pin to a minor version of rok8s-scripts such as `v8.0-alpine`. + +#### You like to live dangerously + +You are okay with your pipeline breaking occasionally and having to upgrade things as they break. + +In this case, go ahead and pin to a major version such as `v8-alpine` + ## 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) +- [Deploying to Kubernetes with Helm](/docs/Helm.md) +- [Deploying to Kubernetes without Helm](/docs/without_Helm.md) - [Managing Kubernetes Secrets Securely](/docs/secrets.md) ### Cloud Specific Documentation diff --git a/bin/install-rok8s-requirements b/bin/install-rok8s-requirements index f7d479a1..eddc4ce5 100755 --- a/bin/install-rok8s-requirements +++ b/bin/install-rok8s-requirements @@ -32,9 +32,9 @@ else PKG_INSTALL="${PKG_MANAGER} install -y" fi -KUBECTL_VERSION="${KUBECTL_VERSION:-v1.11.6}" -HELM_VERSION="${HELM_VERSION:-v2.12.2}" -SOPS_VERSION="${SOPS_VERSION:-3.0.5}" +KUBECTL_VERSION="${KUBECTL_VERSION:-v1.12.6}" +HELM_VERSION="${HELM_VERSION:-v2.13.0}" +SOPS_VERSION="${SOPS_VERSION:-3.2.0}" # make sure sudo is installed if ! hash sudo 2>/dev/null; then diff --git a/docs/index.md b/docs/index.md index 1babcc07..59f6cc36 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@ Each new release of rok8s-scripts comes with a new set of CI images for simple w We currently include a variety of CI Images, including Alpine and Debian Stretch as our recommended starting points. In certain cases you may want to use our images that include Node.js or Golang. -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). +The latest Debian Stretch release can be pulled from `quay.io/reactiveops/ci-images:v8-stretch`. A full list of the latest image tags is available on our [Quay repository](https://quay.io/repository/reactiveops/ci-images). ## Examples diff --git a/docs/releasing.md b/docs/releasing.md index 1343794b..d04eb462 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,8 +1,5 @@ # Releasing New Versions of rok8s-scripts -## Before Merging the Pull Request! -Please be sure to update `./setup.py` and `./package.json` to reflect the new version you wish to release. CODEOWNERS should be able to answer what the next version to release should be. - ## Creating the Tag Create an annotated tag on the commit you would like to release diff --git a/examples/ci/.circleci/config.yml b/examples/ci/.circleci/config.yml index acbf8e7c..82c065b3 100644 --- a/examples/ci/.circleci/config.yml +++ b/examples/ci/.circleci/config.yml @@ -14,7 +14,7 @@ references: deploy_steps: &deploy_steps docker: - - image: quay.io/reactiveops/ci-images:v7-alpine + - image: quay.io/reactiveops/ci-images:v8-alpine steps: - checkout - *set_environment_variables @@ -24,7 +24,7 @@ references: jobs: imagebuild: docker: - - image: quay.io/reactiveops/ci-images:v7-alpine + - image: quay.io/reactiveops/ci-images:v8-alpine steps: - checkout - setup_remote_docker diff --git a/examples/ci/.gitlab-ci.yml b/examples/ci/.gitlab-ci.yml index 2be28b7e..6c9546f2 100644 --- a/examples/ci/.gitlab-ci.yml +++ b/examples/ci/.gitlab-ci.yml @@ -13,7 +13,7 @@ variables: DOCKER_HOST: tcp://localhost:2375 DOCKER_DRIVER: overlay2 -image: quay.io/reactiveops/ci-images:v7-alpine +image: quay.io/reactiveops/ci-images:v8-alpine services: - docker:dind @@ -75,4 +75,4 @@ deploy_production: - helm-deploy -f $ROK8S_CONFIG only: - /^v.*/ - when: manual \ No newline at end of file + when: manual diff --git a/examples/ci/bitbucket-pipelines.yml b/examples/ci/bitbucket-pipelines.yml index 1044c09c..e59cc6a8 100644 --- a/examples/ci/bitbucket-pipelines.yml +++ b/examples/ci/bitbucket-pipelines.yml @@ -1,4 +1,4 @@ -image: quay.io/reactiveops/ci-images:v7-stretch +image: quay.io/reactiveops/ci-images:v8-stretch aliases: - &initialize-env | diff --git a/package.json b/package.json deleted file mode 100644 index 247f08bc..00000000 --- a/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "author": "ReactiveOps ", - "bin": { - "decrypt-kubecfg": "./bin/decrypt-kubecfg", - "docker-build": "./bin/docker-build", - "docker-pull": "./bin/docker-pull", - "docker-push": "./bin/docker-push", - "docker-resolve": "./bin/docker-resolve", - "get-remote-kubecfg": "./bin/get-remote-kubecfg", - "get-secrets": "./bin/get-secrets", - "helm-deploy": "./bin/helm-deploy", - "helm-template": "./bin/helm-template", - "install-rok8s-requirements": "./bin/install-rok8s-requirements", - "k8s-apply": "./bin/k8s-apply", - "k8s-delete": "./bin/k8s-delete", - "k8s-deploy": "./bin/k8s-deploy", - "k8s-deploy-and-verify": "./bin/k8s-deploy-and-verify", - "k8s-deploy-secrets": "./bin/k8s-deploy-secrets", - "k8s-example-config": "./bin/k8s-example-config", - "k8s-lint": "./bin/k8s-lint", - "k8s-read-config": "./bin/k8s-read-config", - "k8s-verify-deployment": "./bin/k8s-verify-deployment", - "manage-context": "./bin/manage-context", - "minikube-apply": "./bin/minikube-apply", - "minikube-build": "./bin/minikube-build", - "minikube-delete": "./bin/minikube-delete", - "minikube-deploy": "./bin/minikube-deploy", - "minikube-services": "./bin/minikube-services", - "minikube-services-all": "./bin/minikube-services-all", - "prepare-awscli": "./bin/prepare-awscli", - "prepare-gcloud": "./bin/prepare-gcloud", - "prepare-kubectl": "./bin/prepare-kubectl", - "rollback-deployment": "./bin/rollback-deployment", - "run-blocking-job": "./bin/run-blocking-job", - "timeout.sh": "./bin/timeout.sh", - "verify-deployment": "./bin/verify-deployment" - }, - "description": "Bash scripts for deploying and managing applications in Kubernetes", - "license": "MIT", - "name": "rok8s-scripts", - "repository": { - "type": "git", - "url": "https://github.com/reactiveops/rok8s-scripts.git" - }, - "version": "7.24.0" -} \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 92fe9b4f..00000000 --- a/setup.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -- coding: utf-8 -- -# Copyright 2017 Reactive Ops Inc. -# -# Licensed under the Apache License, Version 2.0 (the “License”); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an “AS IS” BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import sys -import glob -from setuptools import setup, find_packages - -try: - from setuptools import setup, find_packages -except ImportError: - print("setup tools required. Please run: " - "pip install setuptools).") - sys.exit(1) - -__version__ = '7.24.0' -__author__ = 'ReactiveOps, Inc.' - - -bin_files = glob.glob('./bin/*') - -setup(name='rok8s-scripts', - version=__version__, - description='Bash scripts for deploying and managing applications in Kubernetes', - author=__author__, - author_email='reactive@reactiveops.com', - url='http://reactiveops.com/', - license='Apache2.0', - include_package_data=True, - install_requires=[], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: Apache License, Version 2.0', - 'Natural Language :: English', - 'Operating System :: POSIX', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Topic :: System :: Installation/Setup', - 'Topic :: System :: Systems Administration', - 'Topic :: Utilities', - ], - scripts=bin_files - ) diff --git a/test/npm.sh b/test/npm.sh deleted file mode 100755 index dbea1d48..00000000 --- a/test/npm.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cd $(mktemp -d) -npm install git://github.com/reactiveops/rok8s-scripts.git#${CIRCLE_SHA1} \ No newline at end of file diff --git a/test/pip.sh b/test/pip.sh deleted file mode 100755 index 5029b8c7..00000000 --- a/test/pip.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -pip install --user . -PIP_EXIT_CODE=$? - -pip install semver -latest_release="$(git describe --abbrev=0 --tags)" -latest_release="${latest_release#*v}" -setup_py_version="$(python setup.py --version)" - -if ! python -c "import semver, sys; sys.exit(0 if semver.match('${setup_py_version}', '>=${latest_release}') else 1)"; then - echo "Repo setup.py version is stale: $setup_py_version Latest Git tag release: $latest_release" - PIP_EXIT_CODE=1 -fi - -exit $PIP_EXIT_CODE diff --git a/test/run.sh b/test/run.sh index 8107f889..a167ff0c 100755 --- a/test/run.sh +++ b/test/run.sh @@ -15,28 +15,6 @@ else EXIT_CODE=1 fi -echo "------------------------" -echo "Running NPM Tests" -echo "------------------------" - -if test/npm.sh ; then - echo "✅ NPM Tests Passed" -else - echo "⛔️ NPM Tests Failed" - EXIT_CODE=1 -fi - -echo "------------------------" -echo "Running Pip Tests" -echo "------------------------" - -if test/pip.sh ; then - echo "✅ Pip Tests Passed" -else - echo "⛔️ Pip Tests Failed" - EXIT_CODE=1 -fi - echo "------------------------" echo "Running K8S Lint Tests" echo "------------------------"