diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..269534f --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,54 @@ +local distros = [ + { name: 'amazon', version: '1' }, + { name: 'amazon', version: '2' }, + // { name: 'centos', version: '6' }, + { name: 'centos', version: '7' }, + { name: 'debian', version: '8' }, + { name: 'debian', version: '9' }, + // { name: 'ubuntu', version: '1404' }, + // { name: 'ubuntu', version: '1604' }, + { name: 'ubuntu', version: '1804' }, +]; + +local Shellcheck() = { + kind: 'pipeline', + name: 'run-shellcheck', + + steps: [ + { + name: 'build', + image: 'koalaman/shellcheck-alpine', + commands: [ + 'shellcheck -s sh -f checkstyle bootstrap-salt.sh', + ], + }, + ], +}; + +local Build(os, os_version) = { + kind: 'pipeline', + name: std.format('build-%s-%s', [os, os_version]), + + steps: [ + { + name: 'build', + privileged: true, + image: 'saltstack/drone-plugin-kitchen', + settings: { + target: std.format('%s-%s', [os, os_version]), + requirements: 'tests/requirements.txt', + }, + }, + ], + depends_on: [ + 'run-shellcheck', + ], +}; + + +[ + Shellcheck(), +] + [ + Build(distro.name, distro.version) + for distro in distros +] diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..07d8a12 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,133 @@ +--- +kind: pipeline +name: run-shellcheck + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: koalaman/shellcheck-alpine + commands: + - shellcheck -s sh -f checkstyle bootstrap-salt.sh + +--- +kind: pipeline +name: build-amazon-1 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: saltstack/drone-plugin-kitchen + settings: + requirements: tests/requirements.txt + target: amazon-1 + privileged: true + +depends_on: +- run-shellcheck + +--- +kind: pipeline +name: build-amazon-2 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: saltstack/drone-plugin-kitchen + settings: + requirements: tests/requirements.txt + target: amazon-2 + privileged: true + +depends_on: +- run-shellcheck + +--- +kind: pipeline +name: build-centos-7 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: saltstack/drone-plugin-kitchen + settings: + requirements: tests/requirements.txt + target: centos-7 + privileged: true + +depends_on: +- run-shellcheck + +--- +kind: pipeline +name: build-debian-8 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: saltstack/drone-plugin-kitchen + settings: + requirements: tests/requirements.txt + target: debian-8 + privileged: true + +depends_on: +- run-shellcheck + +--- +kind: pipeline +name: build-debian-9 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: saltstack/drone-plugin-kitchen + settings: + requirements: tests/requirements.txt + target: debian-9 + privileged: true + +depends_on: +- run-shellcheck + +--- +kind: pipeline +name: build-ubuntu-1804 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: saltstack/drone-plugin-kitchen + settings: + requirements: tests/requirements.txt + target: ubuntu-1804 + privileged: true + +depends_on: +- run-shellcheck + +--- +kind: signature +hmac: 563c4cb4cefd58c08143192bd72c5a25c5d0edbe4a6d1f5f89c87d3ca2024246 + +... diff --git a/.kitchen.yml b/.kitchen.yml index 886b4f1..71a43d1 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -8,6 +8,7 @@ driver: cap_add: - sys_admin disable_upstart: false + use_internal_docker_network: true provisioner: name: salt_solo @@ -118,4 +119,4 @@ suites: verifier: name: shell remote_exec: false - command: pytest -v tests/integration/ + command: pytest --cache-clear -v tests/integration/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7232546..0000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -language: ruby - -services: - - docker - -addons: - apt: - packages: - - curl - - git - - shellcheck - - python-pip - -rvm: - - ruby - -env: - matrix: - - PLATFORM=fedora - - PLATFORM=centos-7 - - PLATFORM=centos-6 - - PLATFORM=amazon-1 - - PLATFORM=amazon-2 - - PLATFORM=ubuntu-1804 - - PLATFORM=ubuntu-1604 - - PLATFORM=ubuntu-1404 - - PLATFORM=debian-8 - - PLATFORM=debian-9 - - PLATFORM=arch - - PLATFORM=opensuse - -matrix: - allow_failures: - - env: PLATFORM=ubuntu-1804 - - env: PLATFORM=ubuntu-1604 - - env: PLATFORM=debian-8 - - env: PLATFORM=debian-9 - - env: PLATFORM=centos-6 - -sudo: true -dist: trusty - -before_install: - - pip install --user -r tests/requirements.txt - -script: - # Check shell scripts - - shellcheck -s sh -f checkstyle bootstrap-salt.sh - # Run test-kitchen with docker driver: - - bundle exec kitchen create -l warn -c 6 "$PLATFORM" - - bundle exec kitchen verify "$PLATFORM" - -after_script: - - bundle exec kitchen list $PLATFORM - - bundle exec kitchen destroy "$PLATFORM" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec421fd..b7a3a8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,7 +96,7 @@ a bug fix or feature implementation can be merged in. ### PR Tests -There are several Jenkins jobs that run on each Pull Request. Most of these are +There are several build jobs that run on each Pull Request. Most of these are CI jobs that set up different steps, such as setting up the job, cloning the repo from the PR, etc. diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index b135966..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,114 +0,0 @@ -import java.util.Random - -Random rand = new Random() - -// ONLY CHANGE THIS BIT PLEASE -def baseDistros = ["debian8", - "suse", - "centos6", - "arch", - "ubuntu-14.04", - "ubuntu-18.04", - "windows", - ] -def versions = ["stable", "git", "stable-old"] - -def basePrDistros = ["ubuntu-16.04", - "centos7"] - -def prVersions = ["stable", "git"] - -// You probably shouldn't be messing with this stuff down here - -def distros = (baseDistros + basePrDistros).unique() - -def notifySuccessful(String stageName) { - slackSend (color: '#00FF00', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" + "\n Stage -- " + stageName) -} - -def notifyFailed(String stageName) { - slackSend (color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" + "\n Stage -- " + stageName) -} - -def runKitchen(String distro) { - echo "kitchen create ${distro}" - echo "kitchen converge ${distro}" - echo "kitchen destroy ${distro}" -} - -def distroversions = [] -for (d in distros) { - for (v in versions) { - distroversions = distroversions + ["${d}-${v}"] - } -} - -def prDistros = (basePrDistros + distros[rand.nextInt(baseDistros.size())]).unique() - -def prDistroversions = [] -for (d in prDistros) { - for (v in prVersions) { - prDistroversions = prDistroversions + ["${d}-${v}"] - } -} - -def makeSetupRuns(dv) { - return { - node { - runKitchen("${dv}") - } - } -} - -def setupRuns = distroversions.collectEntries { - ["kitchen-${it}" : makeSetupRuns("${it}")] -} - -def prSetupRuns = prDistroversions.collectEntries { - ["kitchen-${it}" : makeSetupRuns("${it}")] -} - -node ('bootstrap') { - timestamps { - ansiColor('xterm') { - stage('checkout') { checkout scm } - stage('shellcheck') { - sh 'stack exec -- shellcheck -s sh -f checkstyle bootstrap-salt.sh | tee checkstyle.xml' - checkstyle canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '**/checkstyle.xml', unHealthy: '', unstableTotalAll: '0' - archiveArtifacts artifacts: '**/checkstyle.xml' - } - // if (env.CHANGE_ID) { - // // Running for a PR only runs against 4 random distros from a shorter list - // stage('kitchen-pr') { - // parallel prSetupRuns - // } - // } else { - // // If we're not running for a pr we run *everything* - // stage('kitchen-all') { - // parallel setupRuns - // } - // } - } - } -} - -/* - * TODO: - * 1. Tests for each supported distro in bootstrap + branch shellcheck test (Shellcheck should be done) - * 2. Each distro needs a "stable" install (installs stable packages from our repo) and a "git" install (installs off of a git tag) - * 3. Running against each branch (stable, develop) - * 4. And probably a small subset against each pull request (similar to what we do in salt) - * - * Distros to check: - * Debian 8 - * Suse 42.1 - * CentOS 7 - * CentOS 6 - * Arch - * Ubuntu 16.04 - * Ubuntu 14.04 - * Windows - * - * Runs each against develop and stable - * - */ diff --git a/README.rst b/README.rst index 65c1a03..04b5632 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ Bootstrapping Salt ================== -|windows_build| +|build| .. contents:: :local: @@ -28,6 +28,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file. The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is: +- 2019.01.08: ``ab7f29b75711da4bb79aff98d46654f910d569ebe3e908753a3c5119017bb163`` - 2018.08.15: ``6d414a39439a7335af1b78203f9d37e11c972b3c49c519742c6405e2944c6c4b`` - 2018.08.13: ``98284bdc2b5ebaeb619b22090374e42a68e8fdefe6bff1e73bd1760db4407ed0`` - 2018.04.25: ``e2e3397d6642ba6462174b4723f1b30d04229b75efc099a553e15ea727877dfb`` @@ -424,9 +425,8 @@ Salt components, custom configurations, and even `pre-accepted Minion keys`_ alr .. _`Ubuntu's release schedule`: https://wiki.ubuntu.com/Releases .. _Vagrant: http://www.vagrantup.com - -.. |windows_build| image:: https://ci.appveyor.com/api/projects/status/github/saltstack/salt-bootstrap?branch=develop&svg=true - :target: https://ci.appveyor.com/project/saltstack-public/salt-bootstrap - :alt: Build status of the develop branch on Windows +.. |build| image:: https://drone.saltstack.com/api/badges/saltstack/salt-bootstrap/status.svg + :target: https://drone.saltstack.com/saltstack/salt-bootstrap + :alt: Build status on Linux .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d52abe2..b9d799f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1431,7 +1431,7 @@ __debian_derivatives_translation() { # If the file does not exist, return [ ! -f /etc/os-release ] && return - DEBIAN_DERIVATIVES="(cumulus_.+|devuan|kali|linuxmint|raspbian)" + DEBIAN_DERIVATIVES="(cumulus_.+|devuan|kali|linuxmint|raspbian|bunsenlabs|turnkey)" # Mappings cumulus_2_debian_base="7.0" cumulus_3_debian_base="8.0" @@ -1441,6 +1441,8 @@ __debian_derivatives_translation() { linuxmint_1_debian_base="8.0" raspbian_8_debian_base="8.0" raspbian_9_debian_base="9.0" + bunsenlabs_9_debian_base="9.0" + turnkey_9_debian_base="9.0" # Translate Debian derivatives to their base Debian version match=$(echo "$DISTRO_NAME_L" | grep -E ${DEBIAN_DERIVATIVES}) @@ -1467,6 +1469,14 @@ __debian_derivatives_translation() { _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') _debian_derivative="raspbian" ;; + bunsenlabs) + _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') + _debian_derivative="bunsenlabs" + ;; + turnkey) + _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') + _debian_derivative="turnkey" + ;; esac _debian_version=$(eval echo "\$${_debian_derivative}_${_major}_debian_base" 2>/dev/null) @@ -2778,6 +2788,7 @@ install_ubuntu_git_deps() { __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-msgpack python${PY_PKG_VER}-requests" __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-tornado python${PY_PKG_VER}-yaml" __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-zmq" + __PACKAGES="${__PACKAGES} python-concurrent.futures" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # Install python-libcloud if asked to @@ -5226,6 +5237,8 @@ install_freebsd_git_deps() { SALT_DEPENDENCIES=$(/usr/local/sbin/pkg search ${FROM_FREEBSD} -R -d sysutils/py-salt | grep -i origin | sed -e 's/^[[:space:]]*//' | tail -n +2 | awk -F\" '{print $2}' | tr '\n' ' ') # shellcheck disable=SC2086 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y ${SALT_DEPENDENCIES} || return 1 + # install python meta package + /usr/local/sbin/pkg install -y lang/python || return 1 if ! __check_command_exists git; then /usr/local/sbin/pkg install -y git || return 1