Created
February 3, 2019 12:57
-
-
Save NileshGule/4bf9701ad0a0b1e2aa740f669fedf9d6 to your computer and use it in GitHub Desktop.
Gist for Blog post on Travis CI to Azure migraton
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
# Xcode | |
# Build, test, and archive an Xcode workspace on macOS. | |
# Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more: | |
# https://docs.microsoft.com/azure/devops/pipelines/languages/xcode | |
pool: | |
vmImage: 'macOS 10.13' | |
steps: | |
- script: | | |
export ANSIBLE_INVALID_TASK_ATTRIBUTE_FAILED=False | |
"echo installing ansible" | |
sudo pip install ansible | |
"{ echo '[defaults]'; echo 'roles_path = ../'; echo 'invalid_task_attribute_failed=false'; } >> ansible.cfg" | |
sudo mkdir -p /etc/ansible | |
sudo touch /etc/ansible/hosts | |
# "echo -e '[local]\nlocalhost ansible_connection=local' | sudo tee -a /etc/ansible/hosts > /dev/null" | |
sudo mkdir -p conf | |
ansible-galaxy install -r requirements.yml | |
ansible-playbook main.yml --syntax-check | |
ansible-playbook main.yml | |
displayName : 'Ansible playbook execution' |
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
--- | |
sudo: required | |
language: objective-c | |
# 10.11 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version) | |
# osx_image: xcode7.3 | |
osx_image: xcode9.1 | |
before_install: | |
# Uninstall existing brew installation. | |
# Hacking xCode8.2 build by pipelining 'yes' command (see https://askubuntu.com/questions/338857/automatically-enter-input-in-command-line) | |
- 'yes | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"' | |
- rm -rf /usr/local/Homebrew || true | |
- rm -rf /usr/local/Caskroom || true | |
- rm -rf /usr/local/bin/brew || true | |
# Add rvm installation step to avoid build failure | |
# (see https://github.com/travis-ci/travis-ci/issues/5361) | |
- rvm get stable --auto-dotfiles | |
- yes | rvm install 2.3.0 | |
install: | |
# Install pip. | |
- sudo easy_install pip | |
# Install Ansible. | |
- sudo pip install ansible | |
# Add ansible.cfg to pick up roles path. | |
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" | |
# Add a hosts file. | |
- sudo mkdir -p /etc/ansible | |
- sudo touch /etc/ansible/hosts | |
- "echo -e '[local]\nlocalhost ansible_connection=local' | sudo tee -a /etc/ansible/hosts > /dev/null" | |
# Add conf directory (this is an hack to pass the build) | |
# OhMyZsh setup looks for conf directory | |
- sudo mkdir -p conf | |
script: | |
# Install dependencies. | |
- "ansible-galaxy install -r requirements.yml" | |
# Check the role/playbook's syntax. | |
- "ansible-playbook main.yml --syntax-check" | |
# Test the playbook. | |
- "travis_wait 90 ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' main.yml" | |
# Test the playbook's idempotence. | |
# Note that there would be 18 tasks shown as changed | |
# - idempotence=$(mktemp) | |
# - yes | "ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' main.yml | tee -a ${idempotence}" | |
# - > | |
# tail ${idempotence} | |
# | grep -q 'changed=18.*failed=0' | |
# && (echo 'Idempotence test: pass' && exit 0) | |
# || (echo 'Idempotence test: fail' && exit 1) | |
#checking for 3 changed notifications due to some wierd thing for wakatime vs code plugin, 2 other chnages are related to zshrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment