-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
401 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
dist: xenial | ||
language: bash | ||
services: | ||
- docker | ||
before_install: | ||
- docker pull centos | ||
script: | ||
# Save changed files to a text file to narrow test scope | ||
- "git remote add upstream https://github.com/rackerlabs/auter.git" | ||
- "git fetch upstream develop:rdevelop" | ||
# - "git diff rmaster --name-only >CHANGEDFILES" | ||
# - "cat CHANGEDFILES" | ||
|
||
# Create docker image and run general code checks | ||
- "sudo docker run --rm=true --mount type=bind,source=$(pwd),destination=/auter --name auter-test -td centos:7" | ||
- "docker exec auter-test yum -y -q install epel-release &>/dev/null" | ||
- "docker exec auter-test yum -y -q install ShellCheck aspell &>/dev/null" | ||
- "docker exec auter-test /auter/tests/01-spellcheck.sh" | ||
- "docker exec auter-test /auter/tests/05-shellcheck.sh" | ||
|
||
# RPM Build test | ||
- "tests/10-rpmbuild.sh" | ||
|
||
# DEB Build test | ||
- "tests/20-debuild.sh" | ||
- sudo apt-get update | ||
- sudo apt-get install -y aspell aspell-en | ||
jobs: | ||
include: | ||
- stage: Basic Tests | ||
name: SpellCheck | ||
script: ./tests/01-spellcheck.sh | ||
- name: ShellCheck | ||
script: ./tests/05-shellcheck.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,73 @@ | ||
### Test Plan | ||
# Contributing | ||
|
||
For any changes that are made, the following should be considered the bare minimum to be tested: | ||
When contributing to this repository, please feel free to first start a | ||
discussion either via issue or our mailing list | ||
[[email protected]](mailto://[email protected]) before working | ||
on the change. | ||
|
||
```sh | ||
auter --disable # deletes /var/lib/auter/enabled, prints "auter disabled" | ||
auter --status # prints "auter is currently disabled" | ||
auter --enable # touches /var/lib/auter/enabled, prints "auter enabled" | ||
auter --status # prints "auter is currently enabled and not running" | ||
auter --help # shows help message | ||
auter --version # prints "auter VERSIONNUMBER" | ||
man auter # check the contents of the man page reflect the relevant changes | ||
man auter.conf # if relevant, check the contents of the man page reflect the changes | ||
## Pull Requests | ||
|
||
- Ensure all tests pass on your forked branch prior to submitting the PR; if | ||
necessary add words flagged by the 01-spellcheck.sh test to the dictionary | ||
- All pull requests should be made against the develop branch | ||
- Update the help and man pages with any additional functionality being added by | ||
the PR; try to do this in independent commits to make reviewing easier | ||
- Update the file list in 01-spellcheck.sh if adding a new documentation file | ||
- Don't bump version numbers - this will be done during a release | ||
|
||
### Code standards | ||
|
||
We adhere to Google's [shell style | ||
guide](https://google.github.io/styleguide/shell.xml). One of the current | ||
exceptions is to declare all variables in capitals, not just global variables. | ||
|
||
### Testing changes | ||
|
||
For all changes, the following should be considered the bare minimum to be | ||
tested: | ||
|
||
```bash | ||
auter --disable # deletes /var/lib/auter/enabled, prints "auter disabled" | ||
auter --status # prints "auter is currently disabled" | ||
auter --enable # touches /var/lib/auter/enabled, prints "auter enabled" | ||
auter --status # prints "auter is currently enabled and not running" | ||
auter --help # shows help message | ||
auter --version # prints "auter VERSIONNUMBER" | ||
man auter # check the contents of the man page reflect the relevant changes | ||
man auter.conf # if relevant, check the contents of the man page reflect the changes | ||
``` | ||
|
||
If you don't have any updates available, try downgrade a package. Normally openssl has multiple versions available. If multiple packages are not available in the base repo try enable one of the archive/vault repos: | ||
If no updates are available, try downgrading a package like openssl or curl | ||
which often has several versions available. | ||
|
||
For RPM based distros try: | ||
```sh | ||
yum --showduplicates list curl | ||
yum downgrade curl libcurl | ||
``` | ||
For deb based distros try (Note: You may need to also downgrade dependencies): | ||
RHEL based distributions: | ||
|
||
```bash | ||
$ yum --showduplicates list curl | ||
$ yum downgrade curl libcurl | ||
``` | ||
|
||
Debian based distributions: | ||
|
||
```bash | ||
# This will give you a list of packages that have multiple versions available in the repos: | ||
for PKG in $(dpkg --list | awk '{print $2}'); do VERSIONS="$(apt-cache showpkg $PKG | awk '/Versions:/,/^Reverse Depends:/ {if ($1 ~ /^[0-9]/) print $1}' | xargs)";[[ $(echo ${VERSIONS} | wc -w) -gt 1 ]] && echo "$PKG -% $VERSIONS";done | column -t -s "%" | ||
for PKG in $(dpkg --list | awk '{print $2}'); do | ||
VERSIONS="$(apt-cache showpkg $PKG | awk '/Versions:/,/^Reverse Depends:/ {if ($1 ~ /^[0-9]/) print $1}' | xargs)" | ||
|
||
apt-get update | ||
apt-get install <PACKAGE>=<VERSION> | ||
[[ $(echo ${VERSIONS} | wc -w) -gt 1 ]] && echo "$PKG -% $VERSIONS" | ||
done | column -t -s "%" | ||
|
||
$ apt-get update | ||
$ apt-get install <PACKAGE>=<VERSION> | ||
``` | ||
|
||
Use the following to setup auter's pre/post scripts: | ||
_Note: You may need to also downgrade dependencies._ | ||
|
||
```sh | ||
#### Pre/Post script functionality | ||
|
||
Use the following to setup the pre/post scripts: | ||
|
||
```bash | ||
echo 'logger custom pre prep script ran' > /etc/auter/pre-prep.d/pre_prep_script | ||
echo 'logger custom post prep script ran' > /etc/auter/post-prep.d/post_prep_script | ||
echo 'logger custom pre apply script ran' > /etc/auter/pre-apply.d/pre_apply_script | ||
|
@@ -42,22 +77,54 @@ echo 'logger custom post reboot script ran' > /etc/auter/post-reboot.d/post_rebo | |
chmod +x /etc/auter/*.d/*script | ||
``` | ||
|
||
#### Basic guidelines for testing: | ||
#### General guidelines for testing | ||
|
||
1. Run the base commands directly via command line testing for both positive and | ||
negative outcomes | ||
2. Run the base commands via `at` job, again testing both positive and negative | ||
outcomes | ||
3. Test the effects of the change in the function. Again, if possible, test | ||
success and failure conditions | ||
4. Test all functionality in Auter that is affected by the code changes. | ||
|
||
|
||
#### Release Process | ||
|
||
1. A new issue should be raised with the title of "Prep for <VERSION> Release" | ||
2. Ensure all required pull requests for the new release have been merged to the | ||
develop branch | ||
3. A maintainer with admin rights to the master branch in rackerlabs/auter | ||
should create a new branch based from the develop branch: | ||
|
||
```sh | ||
git clone --branch=develop https://github.com/rackerlabs/auter.git rackerlabs/auter | ||
cd rackerlabs/auter | ||
git checkout -b Release-<NEW_VERSION> | ||
git push origin Release-<NEW_VERSION> | ||
``` | ||
|
||
4. Any new pull requests should be made to the develop branch. The only changes | ||
to the Release-<NEW_VERSION> should be fixing of any review issues for that | ||
branch. | ||
5. Full testing for all supported distributions should be carried out and | ||
tracked in a github project created for the release. Example: | ||
https://github.com/rackerlabs/auter/projects/1 | ||
6. Once all testing has been completed for Release-<NEW_VERSION>, the reviewer | ||
should merge the Release-<NEW_VERSION> branch to both master and develop | ||
branches. | ||
7. Tag a new release named <NEW_VERSION> using template | ||
<major_version>.<minor_version> (Eg: Release 0.11) | ||
|
||
1. Test the commands manually in a normal shell session. | ||
2. Test for both positive and negative outcomes. | ||
3. Test the effects of the change in the function. Again, if possible, test success and failure conditions | ||
4. Test all functionality in auter that is affected by the code changes. | ||
|
||
##### Testing template | ||
|
||
This MUST be completed for all supported distrubutions in all pull requests to the master branch before being merged. | ||
This should be completed for all supported distributions in all pull requests to | ||
the master branch before being merged. | ||
|
||
```md | ||
``` | ||
# <OS test version> | ||
# Steps taken to create install file: | ||
``` | ||
|
||
``` | ||
--- | ||
# Test 1: Basic auter status tests | ||
|
@@ -144,7 +211,7 @@ Checks: | |
``` | ||
- __[ pass/fail ]__ expected updates were applied. Check **_/var/log/apt/history.log_** or **_/var/log/yum.log_** | ||
- __[ pass/fail ]__ **_/var/lib/auter/last-apply-output-default_** contains update info | ||
- __[ pass/fail ]__ no upates available after running. Check `yum update <<<n` or `apt-get --just-print upgrade` | ||
- __[ pass/fail ]__ no updates available after running. Check `yum update <<<n` or `apt-get --just-print upgrade` | ||
- __[ pass/fail ]__ pre/post apply scripts ran successfully, messages logged to syslog | ||
- __[ pass/fail ]__ no mail is sent to the root user with the stdout from auter | ||
##### Output from apply: | ||
|
@@ -195,7 +262,7 @@ Checks: | |
echo 'logger custom post reboot script ran' > /etc/auter/post-reboot.d/post_reboot_script | ||
chmod +x /etc/auter/*.d/*script | ||
``` | ||
3) Adjust the MAXDELAY value to avoid extented sleep times | ||
3) Adjust the MAXDELAY value to avoid extended sleep times | ||
``` | ||
sed -i 's/MAXDELAY.*$/MAXDELAY="60"/g' /etc/auter/auter.conf | ||
``` | ||
|
@@ -303,42 +370,10 @@ Checks: | |
2) Details of new feature | ||
3) Test command | ||
Expected outome: | ||
Expected outcome: | ||
``` | ||
``` | ||
4) Next Test: | ||
etc... | ||
``` | ||
|
||
#### Documentation | ||
|
||
When making any changes to code, make sure documentation (--help, man page) has been updated with the new functionality. | ||
|
||
#### Pull Request Rules | ||
|
||
- All pull requests should be made against the develop branch | ||
- All pull requests MUST be reviewed and approved before merging | ||
- Pull request reviews and merges MUST be completed by another maintainer | ||
- Always squash and merge commits prior to submitting a pull request | ||
- All travis-ci tests should pass before merging | ||
- If the spellcheck test fails, adding the problematic words to the dictionary is a valid option | ||
- If the shellcheck test fails, you should fix the issues mentioned or add a shellcheck ignore directive to the previous line along with a comment on why it is being ignored | ||
|
||
#### Release Process | ||
|
||
1. A new issue should be raised with the title of "Prep for <VERSION> Release" | ||
2. Ensure all required PRs for the new release have been merged to the develop branch | ||
3. A maintainer with admin rights to the master branch in rackerlabs/auter should create a new branch based from the develop branch: | ||
|
||
```sh | ||
git clone --branch=develop https://github.com/rackerlabs/auter.git rackerlabs/auter | ||
cd rackerlabs/auter | ||
git checkout -b Release-<NEW_VERSION> | ||
git push origin Release-<NEW_VERSION> | ||
``` | ||
|
||
4. Any new PRs should be made to the develop branch. The only changes to the Release-<NEW_VERSION> should be fixing of any review issues for that branch. | ||
5. Full testing for all supported OSs should be carried out and tracked in a github project created for the release. Example: https://github.com/rackerlabs/auter/projects/1 | ||
6. Once all testing has been completed for Release-<NEW_VERSION>, the reviewer should merge the Release-<NEW_VERSION> branch to both master and develop branches. | ||
7. Tag a new release named <NEW_VERSION> using template <major ver>.<minor ver> (Eg: Release 0.11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
Project auter is maintained by the auter team. Bug reports & assistance | ||
can be found at our email list: | ||
|
||
``` | ||
[email protected] | ||
``` | ||
Project auter is maintained by the auter team. Bug reports & assistance can be | ||
found at our email list [[email protected]](mailto://[email protected]). | ||
|
||
Original authors at Rackspace (http://www.rackspace.co.uk): | ||
``` | ||
- Cameron Beere | ||
- Piers Cornwell | ||
- Mike Frost | ||
- Paolo Gigante | ||
``` | ||
- Cameron Beere | ||
- Piers Cornwell | ||
- Mike Frost | ||
- Paolo Gigante |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.