Skip to content

Commit

Permalink
implement minimal and possible salt-state validation on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
MalloZup committed Jul 9, 2019
1 parent 855b397 commit 4701168
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@ sudo: required
services:
- docker

addons:
apt:
sources:
- sourceline: 'deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main'
key_url: 'https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub'
packages:
- salt-common

stages:
- validation
- delivery
- submit

jobs:
include:
- stage: validation

script:
- |
# validate states
ci/validate-formula.sh
- stage: delivery
if: type != pull_request
env:
Expand Down
40 changes: 40 additions & 0 deletions ci/validate-formula.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash

# this script is intended to be executed via PRs travis CI
set -e

# 01: hana01

echo "==========================================="
echo " Using primary host "
echo "==========================================="

cp pillar.example example/pillar/hana.sls
cp example/salt/top.sls .

cat >grains <<EOF
host: hana01
EOF

cat >minion <<EOF
root_dir: $PWD
id: travis
EOF

sudo salt-call state.show_highstate --local --file-root=./ --config-dir=. --pillar-root=example/pillar --retcode-passthrough -l debug

echo
echo "==========================================="
echo " Using secondary host "
echo "==========================================="

cat >grains <<EOF
host: hana02
EOF

cat >minion <<EOF
root_dir: $PWD
id: travis
EOF

sudo salt-call state.show_highstate --local --file-root=./ --config-dir=. --pillar-root=example/pillar --retcode-passthrough -l debug
7 changes: 6 additions & 1 deletion pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ hana:
user: 'SYSTEM'
password: 'Qwerty1234'


- host: 'hana02'
sid: 'prd'
instance: 00
Expand All @@ -56,6 +55,12 @@ hana:
# Optional timeout value in seconds to wait until the primary node
# 100 seconds by default
primary_timeout: 100
scenario_type: 'cost-optimized'
cost_optimized_parameters:
global_allocation_limit: '32100'
preload_column_tables: False



- host: hana02
sid: 'qas'
Expand Down

0 comments on commit 4701168

Please sign in to comment.