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

Commit e5c0f6d

Browse files
authored
Merge pull request #27 from mlangbehn/ci_should_ci
Add linters to Travis CI configuration
2 parents ab7e603 + 216799e commit e5c0f6d

File tree

11 files changed

+203
-138
lines changed

11 files changed

+203
-138
lines changed

.bluemix/pipeline.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
---
22
stages:
3-
- name: BUILD
4-
inputs:
5-
- type: git
6-
branch: master
7-
service: ${SAMPLE_REPO}
8-
triggers:
9-
- type: commit
10-
jobs:
11-
- name: Build
12-
type: builder
13-
artifact_dir: ''
14-
build_type: shell
15-
script: |-
16-
#!/bin/bash
17-
bash -n *.sh
18-
- name: DEPLOY
19-
inputs:
20-
- type: job
21-
stage: BUILD
22-
job: Build
23-
dir_name: null
24-
triggers:
25-
- type: stage
26-
properties:
27-
- name: BLUEMIX_USER
28-
type: text
29-
value: ${BLUEMIX_USER}
30-
- name: BLUEMIX_PASSWORD
31-
type: secure
32-
value: ${BLUEMIX_PASSWORD}
33-
- name: BLUEMIX_ACCOUNT
34-
type: secure
35-
value: ${BLUEMIX_ACCOUNT}
36-
- name: CLUSTER_NAME
37-
type: text
38-
value: ${CLUSTER_NAME}
39-
- name: API_KEY
40-
type: secure
41-
value: ${API_KEY}
42-
jobs:
43-
- name: Deploy
44-
type: deployer
45-
target:
46-
region_id: ${PROD_REGION_ID}
47-
organization: ${PROD_ORG_NAME}
48-
space: ${PROD_SPACE_NAME}
49-
application: Pipeline
50-
script: |
51-
#!/bin/bash
52-
. ./scripts/install_bx.sh
53-
./scripts/bx_login.sh
54-
./scripts/deploy.sh
3+
- name: BUILD
4+
inputs:
5+
- type: git
6+
branch: master
7+
service: ${SAMPLE_REPO}
8+
triggers:
9+
- type: commit
10+
jobs:
11+
- name: Build
12+
type: builder
13+
artifact_dir: ''
14+
build_type: shell
15+
script: |-
16+
#!/bin/bash
17+
bash -n *.sh
18+
- name: DEPLOY
19+
inputs:
20+
- type: job
21+
stage: BUILD
22+
job: Build
23+
dir_name: null
24+
triggers:
25+
- type: stage
26+
properties:
27+
- name: BLUEMIX_USER
28+
type: text
29+
value: ${BLUEMIX_USER}
30+
- name: BLUEMIX_PASSWORD
31+
type: secure
32+
value: ${BLUEMIX_PASSWORD}
33+
- name: BLUEMIX_ACCOUNT
34+
type: secure
35+
value: ${BLUEMIX_ACCOUNT}
36+
- name: CLUSTER_NAME
37+
type: text
38+
value: ${CLUSTER_NAME}
39+
- name: API_KEY
40+
type: secure
41+
value: ${API_KEY}
42+
jobs:
43+
- name: Deploy
44+
type: deployer
45+
target:
46+
region_id: ${PROD_REGION_ID}
47+
organization: ${PROD_ORG_NAME}
48+
space: ${PROD_SPACE_NAME}
49+
application: Pipeline
50+
script: |
51+
#!/bin/bash
52+
. ./scripts/install_bx.sh
53+
./scripts/bx_login.sh
54+
./scripts/deploy.sh
5555
hooks:
56-
- enabled: true
57-
label: null
58-
ssl_enabled: false
59-
url: https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish
56+
- enabled: true
57+
label: null
58+
ssl_enabled: false
59+
url: https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish

.bluemix/toolchain.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@ required:
1010

1111
# Github repos
1212
sample-repo:
13-
service_id: githubpublic
14-
parameters:
15-
repo_name: "{{name}}"
16-
repo_url: https://github.com/IBM/Kubernetes-container-service-GitLab-sample
17-
type: clone
18-
has_issues: false
13+
service_id: githubpublic
14+
parameters:
15+
repo_name: "{{name}}"
16+
repo_url: https://github.com/IBM/Kubernetes-container-service-GitLab-sample
17+
type: clone
18+
has_issues: false
1919

2020
# Pipelines
2121
sample-build:
22-
service_id: pipeline
23-
parameters:
24-
name: "{{name}}"
25-
ui-pipeline: true
26-
configuration:
27-
content: $file(pipeline.yml)
28-
env:
29-
SAMPLE_REPO: "sample-repo"
30-
CF_APP_NAME: "{{deploy.parameters.prod-app-name}}"
31-
PROD_SPACE_NAME: "{{deploy.parameters.prod-space}}"
32-
PROD_ORG_NAME: "{{deploy.parameters.prod-organization}}"
33-
PROD_REGION_ID: "{{deploy.parameters.prod-region}}"
34-
BLUEMIX_USER: "{{deploy.parameters.bluemix-user}}"
35-
BLUEMIX_PASSWORD: "{{deploy.parameters.bluemix-password}}"
36-
API_KEY: "{{deploy.parameters.bluemix-api-key}}"
37-
BLUEMIX_ACCOUNT: "{{deploy.parameters.bluemix-cluster-account}}"
38-
CLUSTER_NAME: "{{deploy.parameters.bluemix-cluster-name}}"
39-
execute: true
40-
services: ["sample-repo"]
41-
hidden: [form, description]
22+
service_id: pipeline
23+
parameters:
24+
name: "{{name}}"
25+
ui-pipeline: true
26+
configuration:
27+
content: $file(pipeline.yml)
28+
env:
29+
SAMPLE_REPO: "sample-repo"
30+
CF_APP_NAME: "{{deploy.parameters.prod-app-name}}"
31+
PROD_SPACE_NAME: "{{deploy.parameters.prod-space}}"
32+
PROD_ORG_NAME: "{{deploy.parameters.prod-organization}}"
33+
PROD_REGION_ID: "{{deploy.parameters.prod-region}}"
34+
BLUEMIX_USER: "{{deploy.parameters.bluemix-user}}"
35+
BLUEMIX_PASSWORD: "{{deploy.parameters.bluemix-password}}"
36+
API_KEY: "{{deploy.parameters.bluemix-api-key}}"
37+
BLUEMIX_ACCOUNT: "{{deploy.parameters.bluemix-cluster-account}}"
38+
CLUSTER_NAME: "{{deploy.parameters.bluemix-cluster-name}}"
39+
execute: true
40+
services: ["sample-repo"]
41+
hidden: [form, description]
4242

43-
#Deployment
43+
# Deployment
4444
deploy:
45-
schema:
46-
$ref: deploy.json
47-
service-category: pipeline
48-
parameters:
49-
prod-app-name: "{{sample-repo.parameters.repo_name}}"
45+
schema:
46+
$ref: deploy.json
47+
service-category: pipeline
48+
parameters:
49+
prod-app-name: "{{sample-repo.parameters.repo_name}}"

.travis.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1+
---
2+
language: python
3+
python: 2.7
14
sudo: required
5+
6+
addons:
7+
apt:
8+
sources:
9+
- debian-sid
10+
packages:
11+
- shellcheck
12+
13+
install:
14+
- pip install -U pip
15+
- pip install yamllint
16+
- wget http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_0.5.1_amd64.tar.gz
17+
-O /tmp/bx.tar.gz
18+
- tar xf /tmp/bx.tar.gz -C /tmp
19+
- sudo /tmp/Bluemix_CLI/install_bluemix_cli
20+
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
21+
- chmod +x kubectl
22+
- sudo mv kubectl /usr/local/bin
23+
224
before_script:
3-
- wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key |
4-
sudo apt-key add -
5-
- echo "deb http://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
6-
- sudo apt-get update
7-
- sudo apt-get install cf-cli -y
8-
- wget http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_0.5.1_amd64.tar.gz
9-
-O /tmp/bx.tar.gz
10-
- tar xf /tmp/bx.tar.gz -C /tmp
11-
- sudo /tmp/Bluemix_CLI/install_bluemix_cli
12-
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
13-
- chmod +x kubectl
14-
- sudo mv kubectl /usr/local/bin
25+
- "./tests/test-shellcheck.sh"
26+
- "./tests/test-yamllint.sh"
27+
1528
script: true
16-
env:
17-
global:
18-
- secure: JWfW2aekuP73UUyVrUpvltnN5SPaIrDKYzcH7V54TzjDkZ/98a9nu15te5e1WRUb1W0gZtYnQexfLjdJjtweGMSFvfR0J44MYQt2a2qOExHPU6zYvrIpt91mHKvX3ym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sOHTjbHNq5JwXK1QXNL5LV1vjcXw5S0H+xTovlRC8phk7NeWReZuFeT+h2ksHlsYH8R8e8fT+nNlXy/uoPrWXVobJAjowh5V7oOchm/0i5/jrzAFV6ON3ZrUqrOOYSQbZ3h/4jQf0UP63oPbBr17xgbtsAmXB4RipQ0ktc=
20-
- secure: GPG087lVaNdjHOpv2obmGY+DhxCwz700E8Mo7Yer9ZrXHcnYN9V0dh/fRMU8C04aNW2ZvNa6RNZl/BNMKgQfPx+eEjpX0k8kqJ5fEFgFv7GMWacX89fzAf9mRoqoFV5YnIn/7QMOcN6Mgh5hNPEFRX30VkOrTAm7v/ykRLeoXUVpyhhy1d2Ig/Cv+e67Gz4vQmSoTvKAULBhge5hbMfkK2yutOuSu5hGUj+oCmQDzFHjb4+L4TwQoz58iN0SYc3QHQPTdUJEg+bQvIz7nMNX9koH3EtXo3WCxyqgCTYrfp9pVZaCiWC7EyuA3I15fzBr5aLI0y4bpMBQMLbviskkI5CqyJMavEDPyb285UshoxoLQ9FuPEIepBKpHMZxJQKZ90434cmav9DrlQnU0aApVJMFlHnS6Qg0+UAwyCQsooSe5GzWsJP5UXLrETaHwg1Y+migc73xkE/PkiO0FQxll7z2L3imnMLO3vymW6p2FkpnynrkQelsiSuVx7J5aU88L2gyBwyopwHppgbK/sWlXmB6S2of9T5YB2lZwycxqi6P0WF9jyxazJOLfU2McJ/6BeU8KYXnzTKdpqT4XKuvAa8L7Mlk4Utd1f/Ng0wuh4L8ZU7gU6j/KC1KoQwOCvbl3YjKf5Vc8EYvnUkEfI8OLm0EWLfZdmo3+1oKmDjI9Po=

.yamllint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
rules:
3+
braces:
4+
min-spaces-inside: 0
5+
max-spaces-inside: 0
6+
min-spaces-inside-empty: 0
7+
max-spaces-inside-empty: 0
8+
brackets:
9+
min-spaces-inside: 0
10+
max-spaces-inside: 0
11+
min-spaces-inside-empty: 0
12+
max-spaces-inside-empty: 0
13+
colons:
14+
max-spaces-before: 0
15+
max-spaces-after: 1
16+
commas:
17+
max-spaces-before: 0
18+
min-spaces-after: 1
19+
max-spaces-after: 1
20+
comments:
21+
require-starting-space: true
22+
min-spaces-from-content: 2
23+
comments-indentation: enable
24+
document-end: disable
25+
document-start:
26+
present: true
27+
empty-lines:
28+
max: 2
29+
max-start: 0
30+
max-end: 0
31+
hyphens:
32+
max-spaces-after: 1
33+
indentation:
34+
spaces: consistent
35+
indent-sequences: true
36+
check-multi-line-strings: false
37+
key-duplicates: enable
38+
line-length:
39+
max: 80
40+
allow-non-breakable-words: true
41+
allow-non-breakable-inline-mappings: true
42+
level: warning
43+
new-line-at-end-of-file: enable
44+
new-lines:
45+
type: unix
46+
trailing-spaces: enable
47+
truthy: enable

docker-compose.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
gitlab:
23
image: 'gitlab/gitlab-ce:9.1.0-ce.0'
34
restart: always
@@ -21,9 +22,9 @@ gitlab:
2122
external_url 'http://gitlab.example.com:30080'
2223
gitlab_rails['gitlab_shell_ssh_port'] = 30022
2324
ports:
24-
# both ports must match the port from external_url above
25+
# both ports must match the port from external_url above
2526
- "30080:30080"
26-
# the mapped port must match ssh_port specified above.
27+
# the mapped port must match ssh_port specified above.
2728
- "30022:22"
2829
# the following are hints on what volumes to mount if you want to persist data
2930
# volumes:
@@ -45,7 +46,3 @@ postgresql:
4546
redis:
4647
restart: always
4748
image: redis:3.0.7-alpine
48-
49-
50-
51-

scripts/bx_login.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
if [ -z $CF_ORG ]; then
3+
if [[ -z "$CF_ORG" ]]; then
44
CF_ORG="$BLUEMIX_ORG"
55
fi
6-
if [ -z $CF_SPACE ]; then
6+
if [[ -z "$CF_SPACE" ]]; then
77
CF_SPACE="$BLUEMIX_SPACE"
88
fi
99

1010

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

1616
echo "bx login -a $CF_TARGET_URL"
1717

18-
if [ -z "$API_KEY"]; then
19-
bx login -a "$CF_TARGET_URL" -u "$BLUEMIX_USER" -p "$BLUEMIX_PASSWORD" -c "$BLUEMIX_ACCOUNT" -o "$CF_ORG" -s "$CF_SPACE"
18+
if [[ -z "$API_KEY" ]]; then
19+
bx login -a "$CF_TARGET_URL" -u "$BLUEMIX_USER" -p "$BLUEMIX_PASSWORD" -c "$BLUEMIX_ACCOUNT" -o "$CF_ORG" -s "$CF_SPACE" \
20+
|| echo "Failed to authenticate to Bluemix"
2021
else
21-
bx login -a "$CF_TARGET_URL" --apikey "$API_KEY" -o "$CF_ORG" -s "$CF_SPACE"
22+
bx login -a "$CF_TARGET_URL" --apikey "$API_KEY" -o "$CF_ORG" -s "$CF_SPACE" \
23+
|| echo "Failed to authenticate to Bluemix"
2224
fi
2325

24-
if [ $? -ne 0 ]; then
25-
echo "Failed to authenticate to Bluemix"
26-
exit 1
27-
fi
28-
29-
# Init container clusters
3026
echo "bx cs init"
31-
bx cs init
32-
if [ $? -ne 0 ]; then
27+
28+
if ! bx cs init ; then
3329
echo "Failed to initialize to Bluemix Container Service"
3430
exit 1
3531
fi

scripts/deploy.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/bin/bash
22

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

1010
echo -e "Configuring vars"
11-
exp=$(bx cs cluster-config $CLUSTER_NAME | grep export)
12-
if [ $? -ne 0 ]; then
11+
if ! exp=$(bx cs cluster-config "$CLUSTER_NAME" | grep export); then
1312
echo "Cluster $CLUSTER_NAME not created or not ready."
1413
exit 1
1514
fi

scripts/install_bx.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ wget --quiet --output-document=/tmp/Bluemix_CLI_amd64.tar.gz http://public.dhe.
55
tar -xf /tmp/Bluemix_CLI_amd64.tar.gz --directory=/tmp
66

77
# Create bx alias
8-
echo "#!/bin/sh" >/tmp/Bluemix_CLI/bin/bx
9-
echo "/tmp/Bluemix_CLI/bin/bluemix \"\$@\" " >>/tmp/Bluemix_CLI/bin/bx
10-
chmod +x /tmp/Bluemix_CLI/bin/*
8+
echo "#!/bin/sh" > /tmp/Bluemix_CLI/bin/bx
9+
echo "/tmp/Bluemix_CLI/bin/bluemix \"\$@\" " >> /tmp/Bluemix_CLI/bin/bx
10+
chmod 0755 /tmp/Bluemix_CLI/bin/*
1111

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

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

1717
echo "Install kubectl"
18-
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
18+
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
1919
chmod +x /tmp/Bluemix_CLI/bin/kubectl
2020

21-
if [ -n "$DEBUG" ]; then
21+
if [[ -n "$DEBUG" ]]; then
2222
bx --version
2323
bx plugin list
2424
fi

0 commit comments

Comments
 (0)