Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Add linters to Travis CI configuration #27

Merged
merged 1 commit into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 56 additions & 56 deletions .bluemix/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
---
stages:
- name: BUILD
inputs:
- type: git
branch: master
service: ${SAMPLE_REPO}
triggers:
- type: commit
jobs:
- name: Build
type: builder
artifact_dir: ''
build_type: shell
script: |-
#!/bin/bash
bash -n *.sh
- name: DEPLOY
inputs:
- type: job
stage: BUILD
job: Build
dir_name: null
triggers:
- type: stage
properties:
- name: BLUEMIX_USER
type: text
value: ${BLUEMIX_USER}
- name: BLUEMIX_PASSWORD
type: secure
value: ${BLUEMIX_PASSWORD}
- name: BLUEMIX_ACCOUNT
type: secure
value: ${BLUEMIX_ACCOUNT}
- name: CLUSTER_NAME
type: text
value: ${CLUSTER_NAME}
- name: API_KEY
type: secure
value: ${API_KEY}
jobs:
- name: Deploy
type: deployer
target:
region_id: ${PROD_REGION_ID}
organization: ${PROD_ORG_NAME}
space: ${PROD_SPACE_NAME}
application: Pipeline
script: |
#!/bin/bash
. ./scripts/install_bx.sh
./scripts/bx_login.sh
./scripts/deploy.sh
- name: BUILD
inputs:
- type: git
branch: master
service: ${SAMPLE_REPO}
triggers:
- type: commit
jobs:
- name: Build
type: builder
artifact_dir: ''
build_type: shell
script: |-
#!/bin/bash
bash -n *.sh
- name: DEPLOY
inputs:
- type: job
stage: BUILD
job: Build
dir_name: null
triggers:
- type: stage
properties:
- name: BLUEMIX_USER
type: text
value: ${BLUEMIX_USER}
- name: BLUEMIX_PASSWORD
type: secure
value: ${BLUEMIX_PASSWORD}
- name: BLUEMIX_ACCOUNT
type: secure
value: ${BLUEMIX_ACCOUNT}
- name: CLUSTER_NAME
type: text
value: ${CLUSTER_NAME}
- name: API_KEY
type: secure
value: ${API_KEY}
jobs:
- name: Deploy
type: deployer
target:
region_id: ${PROD_REGION_ID}
organization: ${PROD_ORG_NAME}
space: ${PROD_SPACE_NAME}
application: Pipeline
script: |
#!/bin/bash
. ./scripts/install_bx.sh
./scripts/bx_login.sh
./scripts/deploy.sh
hooks:
- enabled: true
label: null
ssl_enabled: false
url: https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish
- enabled: true
label: null
ssl_enabled: false
url: https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish
64 changes: 32 additions & 32 deletions .bluemix/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ required:

# Github repos
sample-repo:
service_id: githubpublic
parameters:
repo_name: "{{name}}"
repo_url: https://github.com/IBM/Kubernetes-container-service-GitLab-sample
type: clone
has_issues: false
service_id: githubpublic
parameters:
repo_name: "{{name}}"
repo_url: https://github.com/IBM/Kubernetes-container-service-GitLab-sample
type: clone
has_issues: false

# Pipelines
sample-build:
service_id: pipeline
parameters:
name: "{{name}}"
ui-pipeline: true
configuration:
content: $file(pipeline.yml)
env:
SAMPLE_REPO: "sample-repo"
CF_APP_NAME: "{{deploy.parameters.prod-app-name}}"
PROD_SPACE_NAME: "{{deploy.parameters.prod-space}}"
PROD_ORG_NAME: "{{deploy.parameters.prod-organization}}"
PROD_REGION_ID: "{{deploy.parameters.prod-region}}"
BLUEMIX_USER: "{{deploy.parameters.bluemix-user}}"
BLUEMIX_PASSWORD: "{{deploy.parameters.bluemix-password}}"
API_KEY: "{{deploy.parameters.bluemix-api-key}}"
BLUEMIX_ACCOUNT: "{{deploy.parameters.bluemix-cluster-account}}"
CLUSTER_NAME: "{{deploy.parameters.bluemix-cluster-name}}"
execute: true
services: ["sample-repo"]
hidden: [form, description]
service_id: pipeline
parameters:
name: "{{name}}"
ui-pipeline: true
configuration:
content: $file(pipeline.yml)
env:
SAMPLE_REPO: "sample-repo"
CF_APP_NAME: "{{deploy.parameters.prod-app-name}}"
PROD_SPACE_NAME: "{{deploy.parameters.prod-space}}"
PROD_ORG_NAME: "{{deploy.parameters.prod-organization}}"
PROD_REGION_ID: "{{deploy.parameters.prod-region}}"
BLUEMIX_USER: "{{deploy.parameters.bluemix-user}}"
BLUEMIX_PASSWORD: "{{deploy.parameters.bluemix-password}}"
API_KEY: "{{deploy.parameters.bluemix-api-key}}"
BLUEMIX_ACCOUNT: "{{deploy.parameters.bluemix-cluster-account}}"
CLUSTER_NAME: "{{deploy.parameters.bluemix-cluster-name}}"
execute: true
services: ["sample-repo"]
hidden: [form, description]

#Deployment
# Deployment
deploy:
schema:
$ref: deploy.json
service-category: pipeline
parameters:
prod-app-name: "{{sample-repo.parameters.repo_name}}"
schema:
$ref: deploy.json
service-category: pipeline
parameters:
prod-app-name: "{{sample-repo.parameters.repo_name}}"
42 changes: 25 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
---
language: python
python: 2.7
sudo: required

addons:
apt:
sources:
- debian-sid
packages:
- shellcheck

install:
- pip install -U pip
- pip install yamllint
- wget http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_0.5.1_amd64.tar.gz
-O /tmp/bx.tar.gz
- tar xf /tmp/bx.tar.gz -C /tmp
- sudo /tmp/Bluemix_CLI/install_bluemix_cli
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
- chmod +x kubectl
- sudo mv kubectl /usr/local/bin

before_script:
- wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key |
sudo apt-key add -
- echo "deb http://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
- sudo apt-get update
- sudo apt-get install cf-cli -y
- wget http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_0.5.1_amd64.tar.gz
-O /tmp/bx.tar.gz
- tar xf /tmp/bx.tar.gz -C /tmp
- sudo /tmp/Bluemix_CLI/install_bluemix_cli
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
- chmod +x kubectl
- sudo mv kubectl /usr/local/bin
- "./tests/test-shellcheck.sh"
- "./tests/test-yamllint.sh"

script: true
env:
global:
- secure: JWfW2aekuP73UUyVrUpvltnN5SPaIrDKYzcH7V54TzjDkZ/98a9nu15te5e1WRUb1W0gZtYnQexfLjdJjtweGMSFvfR0J44MYQt2a2qOExHPU6zYvrIpt91mHKvX3ymjCVVkhxfv85IXKTAsXy2DDFw7WvDBdauwdEIqDauU8EnnRzdSP21UVOA2aMn+RZp2aUziUXDOqZIIzDvzLs3V0VrAuHEyLsttPkijV9KrMFYkOGMpNYzQInfJOSo/6QkaiIwUntP++LQRTWWpFpX8K2N1rTmr4GVcF3jww2u+0E6Pl282n26KFOMU3RMbi+9gq3jqKPlbHT/uXRnmISwBhi70+s9WUxSrYH7cUFOEHohWtUUfsEwf5l9bk6pgQ8cazeKdS869EG67Y8PKMJ0NaQUGDzLm+0l1DL5CJboJYuT9OEVPcqsaP5/YegRmNkiaUmobIJUN65lbPFnLJJXq28EHfndHT/EHVFuhbb0a86459SWeGL23Sqc3zKfsQdkqcvwEVPQUyNF/pk4udii1g4UqOYsr57q1fKdYnT6EXUbubsqvk+vwkTeXEjycIdgE+3SRJ1+8C5RqGgMo/CZooddVzzT55hAcyy6JrOCNcdGh3zZm87J6uVUgSCOzVXLVfo8OVG+VJEIWydgDH9pNtGArSsmevg2JXbVpbev98LA=
- secure: YTUTRQYxCXpzcAnuSCJbicySYOPmqBVTIaqglpFluDBV9XnT5I0UAnHOZdB/Dp0EcQNrT/ML9y+Hwpo7P7Cc7bOqhezhb4GQkh27bb8QBKoG36mD6hIFpS0agNFJMS6Knw+ORf8kAWr2jyth0tEhC8zum+Uis3Bq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YB2lZwycxqi6P0WF9jyxazJOLfU2McJ/6BeU8KYXnzTKdpqT4XKuvAa8L7Mlk4Utd1f/Ng0wuh4L8ZU7gU6j/KC1KoQwOCvbl3YjKf5Vc8EYvnUkEfI8OLm0EWLfZdmo3+1oKmDjI9Po=
47 changes: 47 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
colons:
max-spaces-before: 0
max-spaces-after: 1
commas:
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
require-starting-space: true
min-spaces-from-content: 2
comments-indentation: enable
document-end: disable
document-start:
present: true
empty-lines:
max: 2
max-start: 0
max-end: 0
hyphens:
max-spaces-after: 1
indentation:
spaces: consistent
indent-sequences: true
check-multi-line-strings: false
key-duplicates: enable
line-length:
max: 80
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
level: warning
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy: enable
9 changes: 3 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
gitlab:
image: 'gitlab/gitlab-ce:9.1.0-ce.0'
restart: always
Expand All @@ -21,9 +22,9 @@ gitlab:
external_url 'http://gitlab.example.com:30080'
gitlab_rails['gitlab_shell_ssh_port'] = 30022
ports:
# both ports must match the port from external_url above
# both ports must match the port from external_url above
- "30080:30080"
# the mapped port must match ssh_port specified above.
# the mapped port must match ssh_port specified above.
- "30022:22"
# the following are hints on what volumes to mount if you want to persist data
# volumes:
Expand All @@ -45,7 +46,3 @@ postgresql:
redis:
restart: always
image: redis:3.0.7-alpine




26 changes: 11 additions & 15 deletions scripts/bx_login.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
#!/bin/sh
#!/bin/bash

if [ -z $CF_ORG ]; then
if [[ -z "$CF_ORG" ]]; then
CF_ORG="$BLUEMIX_ORG"
fi
if [ -z $CF_SPACE ]; then
if [[ -z "$CF_SPACE" ]]; then
CF_SPACE="$BLUEMIX_SPACE"
fi


if ([ -z "$BLUEMIX_USER" ] || [ -z "$BLUEMIX_PASSWORD" ] || [ -z "$BLUEMIX_ACCOUNT" ]) && ([ -z "$API_KEY"]); then
if ([ -z "$BLUEMIX_USER" ] || [ -z "$BLUEMIX_PASSWORD" ] || [ -z "$BLUEMIX_ACCOUNT" ]) && ([ -z "$API_KEY" ]); then
echo "Define all required environment variables and re-run the stage."
exit 1
fi

echo "bx login -a $CF_TARGET_URL"

if [ -z "$API_KEY"]; then
bx login -a "$CF_TARGET_URL" -u "$BLUEMIX_USER" -p "$BLUEMIX_PASSWORD" -c "$BLUEMIX_ACCOUNT" -o "$CF_ORG" -s "$CF_SPACE"
if [[ -z "$API_KEY" ]]; then
bx login -a "$CF_TARGET_URL" -u "$BLUEMIX_USER" -p "$BLUEMIX_PASSWORD" -c "$BLUEMIX_ACCOUNT" -o "$CF_ORG" -s "$CF_SPACE" \
|| echo "Failed to authenticate to Bluemix"
else
bx login -a "$CF_TARGET_URL" --apikey "$API_KEY" -o "$CF_ORG" -s "$CF_SPACE"
bx login -a "$CF_TARGET_URL" --apikey "$API_KEY" -o "$CF_ORG" -s "$CF_SPACE" \
|| echo "Failed to authenticate to Bluemix"
fi

if [ $? -ne 0 ]; then
echo "Failed to authenticate to Bluemix"
exit 1
fi

# Init container clusters
echo "bx cs init"
bx cs init
if [ $? -ne 0 ]; then

if ! bx cs init ; then
echo "Failed to initialize to Bluemix Container Service"
exit 1
fi
7 changes: 3 additions & 4 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash

echo "Create Gitlab"
IP_ADDR=$(bx cs workers $CLUSTER_NAME | grep Ready | awk '{ print $2 }')
if [ -z $IP_ADDR ]; then
IP_ADDR=$(bx cs workers "$CLUSTER_NAME" | grep Ready | awk '{ print $2 }')
if [[ -z "$IP_ADDR" ]]; then
echo "$CLUSTER_NAME not created or workers not ready"
exit 1
fi

echo -e "Configuring vars"
exp=$(bx cs cluster-config $CLUSTER_NAME | grep export)
if [ $? -ne 0 ]; then
if ! exp=$(bx cs cluster-config "$CLUSTER_NAME" | grep export); then
echo "Cluster $CLUSTER_NAME not created or not ready."
exit 1
fi
Expand Down
10 changes: 5 additions & 5 deletions scripts/install_bx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ wget --quiet --output-document=/tmp/Bluemix_CLI_amd64.tar.gz http://public.dhe.
tar -xf /tmp/Bluemix_CLI_amd64.tar.gz --directory=/tmp

# Create bx alias
echo "#!/bin/sh" >/tmp/Bluemix_CLI/bin/bx
echo "/tmp/Bluemix_CLI/bin/bluemix \"\$@\" " >>/tmp/Bluemix_CLI/bin/bx
chmod +x /tmp/Bluemix_CLI/bin/*
echo "#!/bin/sh" > /tmp/Bluemix_CLI/bin/bx
echo "/tmp/Bluemix_CLI/bin/bluemix \"\$@\" " >> /tmp/Bluemix_CLI/bin/bx
chmod 0755 /tmp/Bluemix_CLI/bin/*

export PATH="/tmp/Bluemix_CLI/bin:$PATH"

echo "Install the Bluemix container-service plugin"
bx plugin install container-service -r Bluemix

echo "Install kubectl"
wget --quiet --output-document=/tmp/Bluemix_CLI/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
wget --quiet --output-document=/tmp/Bluemix_CLI/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)"/bin/linux/amd64/kubectl
chmod +x /tmp/Bluemix_CLI/bin/kubectl

if [ -n "$DEBUG" ]; then
if [[ -n "$DEBUG" ]]; then
bx --version
bx plugin list
fi
Expand Down
Loading