Coder Social home page Coder Social logo

gocd_server's Introduction

SAnsible

This repo is a set of tools to aid with the development of roles in the SAnsible organisation.

Role style guide

All roles in SAnsible follow a similiar pattern, however some roles are slightly older than others so their Makefiles, tests and travis.yml files are somewhat out of date.

In general though the roles follow a standardised pattern.

  • Tests are conducted using Vagrant locally and travis for PRs and branches
  • Proper YAML syntax should be used everywhere
  • Each role has an editorconfig file to ensure proper formating
  • The Makefile contains useful targets for running the tests
  • Two tags are present in each role: build and configure
  • The test.yml playbook uses an additional tag called assert
  • The build tag handles installation and things that do not vary per environment
  • The configure tag handles config files and other things that vary per environment
  • The additional assert tag covers tests and is generally used for local tests and travis tests
  • Ansible-lint is used as part of the tests (pip install ansible-lint)
  • Variables all have a parent hash, this has the advantage of making it easier to read the vars, but has the disadvantage of requiring hash behaviour to be set to 'merge'
  • The parent hash should have the prefix sansible_ eg. sansible_ansible

Contributing

If you wish to contribute to one of our roles please open an issue in the roles repo first, then create a branch named with the issue number (eg. GITHUB-1) making sure that you create your branch from develop.

When you are ready to open a PR please squash all of your commits into one and ensure that your commit message contains the Github ID in it's title surrounded by square braces.

Please try to include a descriptive title followed by more detail in the body, eg:

[GITHUB-1] Fixes something

A more detailed description of how this PR will close the issue at hand.

A good guide on commit messages is Tim Pope's guide.

Once your PR is opened Travis will test it, if all the tests passed your PR will be considered for merging.

Creating new roles

Here are the steps for adding a new Sansible role:

  • Create new repo in Sansible org, starting with the default README option
  • Create a develop branch from master, should have master and develop after this
  • Set develop to be the default branch
  • Set branch protection on both master and develop branches
  • Set develop to require reviews before merges
  • Add Trusted Collaborators with admin permissions
  • Add Collaborators with write permissions
  • Login to Travis, re-sync repos and add new repo
  • Create first issue with the title 'Add initial role'
  • Copy skeleton for role from the scaffold branch in the Sansible repo
  • Add role contents following standards in the style guide above
  • Open first PR referencing initial role issue
  • Once Travis tests start running set these as a merge requirement for develop
  • Once first PR is merged login to Ansible Galaxy and add new repo
  • Follow the merge and release guide for pushing from develop to master
  • Check Ansible Galaxy to ensure the new role is in place

Merges and releases

Once a PR is merged into the develop branch Travis will run tests against it, once finished the develop branch needs to be merged into the master, at the moment this process is manual and can be done like so:

  • Checkout this repo
  • Cd into your local checkout of the role that your PR was for
  • Run the sansible release script: bash [PATH TO THIS REPO]/bin/release.sh

The release script will handle the merge and cut a new release tag for you, note that you must have write permissions on the roles repo to do this.

Once master is updated Travis will run tests on the master and update the role in Galaxy.

You can run ./bin/report.sh to check the status of all sansible role repos.

Versioning

The sansible release script will automatically increment the patch version by one when it is run, it will check what the last version is and simply increment it.

In addition to the semver versions we always have a major and minor version, eg:

v1.0.1
v1.0.2
v1.0.3
v1.0

The major.minor tag always points to the same commit as the most recent patch version, so in this case v1.0 will be at the same commit as v1.0.3. In your Galaxy requirements file it is recommended that you point to the major.minor version so you automatically get the latest patch.

If you are introducing new features or breaking changes you should bump the major or minor version accordingly, to do this you need to create or edit the version file in the root of the roles repo. The file should be named .version and simply contain the major and minor version like so:

#.version
v1.2

When the Sansible release script is executed it will check this file for the major and minor version and base the release that it cuts on it.

Troubleshooting

Symptom

Despite of running sansible/bin/release.sh successfully without errors, the master branch points to the wrong commit.

Description

On one particular laptop we once observed that the execution of the sansible/bin/release.sh script succeeded but in actual fact the remote master branch was not updated by moving the HEAD. While attempting to go through this process manually, git showed the following warning.

$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behaviour, use:

  git config --global push.default matching

To squelch this message and adopt the new behaviour now, use:

  git config --global push.default simple

This laptop was only recently setup and it had already been used to push commits to remote repositories, however the target branch was usually specified. The weired thing is that with git 2.0 or higher, simple is the default push.default option. Therefore it should normally not be required to be configured.

Solution

Configure the push.default option as the warning outlines. If in doubt, use git config --global push.default simple.

gocd_server's People

Contributors

dennisconrad avatar dm avatar js-kingkong-bot avatar lobsterdore avatar memmerson avatar quater avatar rsgoodall avatar tuxpower avatar wojtek-oledzki avatar woledzki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gocd_server's Issues

Not Possible to Specify Exact Version

When I select gocd_server.version: 17.4.0 (or any other exact version) it fails to install

Expected
Install 17.4.0 version (17.4.0-4892)

Actual
Error with

TASK [sansible.gocd_server : Install go-server] ********************************
fatal: [default]: FAILED! => {"cache_update_time": 1493294976, "cache_updated": false, 
"changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y 
-o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"  
--force-yes   install 'go-server=17.4.0'' failed: E: Version '17.4.0' for 'go-server' was not 
found\n", "stderr": "E: Version '17.4.0' for 'go-server' was not found\n", "stdout": 
"Reading package lists...\nBuilding dependency tree...\nReading state 
information...\n", "stdout_lines": ["Reading package lists...", "Building dependency 
tree...", "Reading state information..."]}

Gocd server module is python3 incompatible

Go installation fails on python3 Ansible during parsing template due to remove 'iteritems' attribute in python 3
https://docs.python.org/3/whatsnew/3.0.html

Python 3

ansible 2.4.0.0
  config file = /Users/tkrzyzanowski/.ansible.cfg
  configured module search path = ['/Users/tkrzyzanowski/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.2 (default, Jul 17 2017, 16:44:45) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
TASK [sansible.gocd_server : Ensures go-server user passwords file] *************************************************************************************************************
fatal: [10.0.252.131]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"}

Python 2:

ansible 2.4.0.0
  config file = /Users/tkrzyzanowski/.ansible.cfg
  configured module search path = [u'/Users/tkrzyzanowski/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.13 (default, Jul 18 2017, 09:17:00) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
TASK [sansible.gocd_server : Ensures go-server user passwords file] *************************************************************************************************************
changed: [10.0.252.131]

Gocd installation fails on post-install scripts

Gocd installation fails on Ubuntu Xenial during post-installation scripts on default settings (when role is contained in playbook without additional parameter definition)

When version is changed to newest one (17.10.*) installation finish successfully

Ansible version:

ansible 2.4.0.0
  config file = /Users/tkrzyzanowski/.ansible.cfg
  configured module search path = ['/Users/tkrzyzanowski/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.2 (default, Jul 17 2017, 16:44:45) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]

Non working configuration:

---
- name: Install GO CD Server
  hosts: all

  roles:
    - name: sansible.gocd_server

Working configuration:

---
- name: Install GO CD Server
  hosts: all

  roles:
    - name: sansible.gocd_server
      gocd_server:
        version: "17.10.*"

Consider using s3s3mirror instead of aws s3 sync

The built in s3 sync command that comes with the AWS cli tools is slow both when calculating diffs and uploading.

There is an alternative tool, s3s3mirror, that uses threads for uploads and diff calculation, it will speed up the back-up and restore scripts considerably.

Can't configure workdir

As a developer
I want to configure path to workdir
So that I can "mount" Go CD on external drive

Can't configure workdir

As a developer
I want to configure path to workdir
So that I can "mount" Go CD on external drive

Fix Flattened Variable Boolean Test

      foo:
        bar: "s3://one.two.three"

and

      foo_bar: "s3://four.five.six"

are tested differently for a boolean value.

      when: foo.bar

works, while

      when: foo_bar

fails:

TASK [debug] *****************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'foo_bar' failed. The error was: template error while templating string: expected token 'end of statement block', got '//'. String: {% if s3://four.five.six %} True {% else %} False {% endif %}\n\nThe error appears to have been in '/Users/dennis.conrad/flatten_issue.yml': line 10, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n  - debug:\n    ^ here\n"}

Java requirement issue - ansible 1.9.4

Hi,
I have tried to use gocd_server but, have issue with java as dependency. run ansible-galaxy install -p ./roles -r roles.yml but still got error with "sansible.java". I have ansible 1.9.4.

Thanks

Add aws backup and restore scripts

As a ops eng.
I want Go CD server to restore all its data
So that it can start automatically in AWS autoscaling group.

Notes

With ASG with desired size set to 1 I want Go CD server to auto-heal in case of any server problems.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.