Skip to content

Commit 6646bb9

Browse files
authored
Indent with two spaces (#33)
1 parent 6f7d851 commit 6646bb9

File tree

11 files changed

+143
-138
lines changed

11 files changed

+143
-138
lines changed

docs/tutorials/gitlab-ci/docker-hub-ratelimit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Create a new GitLab project with `.gitlab-ci.yml` and `scripts/check-docker-hub-
1414

1515
The `scripts/check-docker-hub-ratelimit.sh` script prints current Docker Hub ratelimit and also writes the result to a file if filename is given as first parameter. See [Docker Hub usage and rate limits](https://docs.docker.com/docker-hub/download-rate-limit/#how-can-i-check-my-current-rate) article in Docker documentation for more details.
1616

17-
```yaml title="scripts/check-docker-hub-ratelimit.sh"
17+
```sh title="scripts/check-docker-hub-ratelimit.sh"
1818
---8<--- "docs/tutorials/gitlab-ci/docker-hub-ratelimit/scripts/check-docker-hub-ratelimit.sh"
1919
```
2020

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

33
fetch_ratelimit() {
4-
curl -I -H "Authorization: Bearer $1" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest 2>&1 | grep -i ratelimit
4+
curl -I -H "Authorization: Bearer $1" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest 2>&1 | grep -i ratelimit
55
}
66

77
target=$1
88
token=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
99

1010
if [ -n "$target" ]; then
11-
fetch_ratelimit $token | tee $target;
11+
fetch_ratelimit $token | tee $target;
1212
else
13-
fetch_ratelimit $token;
13+
fetch_ratelimit $token;
1414
fi
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
String d = "docs/tutorials/jenkins/ansible-kubernetes"
22

33
pipeline {
4-
agent any
5-
parameters {
6-
choice(name: 'ANIMAL', choices: ['cat', 'cow', 'dog', 'lion', 'pig'], description: 'Tag to use for deployment image')
7-
}
8-
stages {
9-
stage("deploy") {
10-
agent {
11-
dockerfile {
12-
dir "$d"
13-
reuseNode true
14-
}
15-
}
16-
environment {
17-
K8S_AUTH_KUBECONFIG = credentials('kubeconfig')
18-
KUBECONFIG = credentials('kubeconfig')
19-
}
20-
steps {
21-
sh """
22-
ansible-playbook $d/deploy-to-kubernetes.yml --extra-vars "animal=${params.ANIMAL}"
23-
./$d/wait-until-service-up.sh
24-
"""
25-
}
4+
agent any
5+
parameters {
6+
choice(name: 'ANIMAL', choices: ['cat', 'cow', 'dog', 'lion', 'pig'], description: 'Tag to use for deployment image')
7+
}
8+
stages {
9+
stage("deploy") {
10+
agent {
11+
dockerfile {
12+
dir "$d"
13+
reuseNode true
2614
}
15+
}
16+
environment {
17+
K8S_AUTH_KUBECONFIG = credentials('kubeconfig')
18+
KUBECONFIG = credentials('kubeconfig')
19+
}
20+
steps {
21+
sh """
22+
ansible-playbook $d/deploy-to-kubernetes.yml --extra-vars "animal=${params.ANIMAL}"
23+
./$d/wait-until-service-up.sh
24+
"""
25+
}
2726
}
27+
}
2828
}
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/bin/sh -xe
22

3+
get_hostname() {
4+
kubectl get service animals -o json | \
5+
jq -re .status.loadBalancer.ingress[0].hostname
6+
}
7+
38
# Wait until hostname is available
4-
until kubectl get service animals -o json | jq -re .status.loadBalancer.ingress[0].hostname; do
5-
sleep 15;
9+
until get_hostname; do
10+
sleep 15;
611
done;
712

813
# Wait until animals application is up
9-
hostname=$(kubectl get service animals -o json | jq -re .status.loadBalancer.ingress[0].hostname)
14+
hostname=$(get_hostname)
1015
until curl -sSf $hostname; do
11-
sleep 15;
16+
sleep 15;
1217
done;
1318

1419
echo "Load-balancer URL: $hostname"
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
pipeline {
2-
agent any
3-
options {
4-
timeout(time: 3, unit: 'MINUTES')
5-
}
6-
stages {
7-
stage('Sleep') {
8-
steps {
9-
sleep time: 5, unit: 'MINUTES'
10-
}
11-
}
2+
agent any
3+
options {
4+
timeout(time: 3, unit: 'MINUTES')
5+
}
6+
stages {
7+
stage('Sleep') {
8+
steps {
9+
sleep time: 5, unit: 'MINUTES'
10+
}
1211
}
12+
}
1313
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
pipeline {
2-
agent any
3-
stages {
4-
stage('Fail on purpose') {
5-
steps {
6-
sh 'exit 1'
7-
}
8-
}
2+
agent any
3+
stages {
4+
stage('Fail on purpose') {
5+
steps {
6+
sh 'exit 1'
7+
}
98
}
9+
}
1010
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
String d = "docs/tutorials/jenkins/build-status-pipelines"
22

33
folder('Status') {
4-
description('Example pipelines to produce success, unstable, failed, aborted, and not-built statuses.')
4+
description('Example pipelines to produce success, unstable, failed, aborted, and not-built statuses.')
55
}
66

77
def statuses = ['Success', 'Unstable', 'Failed', 'Aborted']
88
for (status in statuses) {
9-
def name = "Status/${status}"
9+
def name = "Status/${status}"
1010

11-
pipelineJob(name) {
12-
definition {
13-
cps {
14-
script(readFileFromWorkspace("$d/${status.toLowerCase()}.Jenkinsfile"))
15-
sandbox()
16-
}
17-
}
11+
pipelineJob(name) {
12+
definition {
13+
cps {
14+
script(readFileFromWorkspace("$d/${status.toLowerCase()}.Jenkinsfile"))
15+
sandbox()
16+
}
1817
}
19-
queue(name)
18+
}
19+
queue(name)
2020
}
2121

2222
pipelineJob('Status/Not built') {
23-
definition {
24-
cps {
25-
script(readFileFromWorkspace("$d/success.Jenkinsfile"))
26-
sandbox()
27-
}
23+
definition {
24+
cps {
25+
script(readFileFromWorkspace("$d/success.Jenkinsfile"))
26+
sandbox()
2827
}
28+
}
2929
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
pipeline {
2-
agent any
3-
stages {
4-
stage('Say hello') {
5-
steps {
6-
echo 'Hello!'
7-
}
8-
}
2+
agent any
3+
stages {
4+
stage('Say hello') {
5+
steps {
6+
echo 'Hello!'
7+
}
98
}
9+
}
1010
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
pipeline {
2-
agent any
3-
stages {
4-
stage('Set unstable') {
5-
steps {
6-
unstable 'Demo unstable usage'
7-
}
8-
}
2+
agent any
3+
stages {
4+
stage('Set unstable') {
5+
steps {
6+
unstable 'Demo unstable usage'
7+
}
98
}
9+
}
1010
}
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
String d = "docs/tutorials/jenkins/parallel-robot-pipeline"
22

33
pipeline {
4-
agent any
5-
parameters {
6-
string(
7-
name: 'URL',
8-
defaultValue: '',
9-
description: 'Target URL for the Robot Framework tasks')
10-
}
11-
stages {
12-
stage('Run tasks') {
13-
parallel {
14-
stage('Chromium') {
15-
agent { docker {
16-
image 'ghcr.io/cicd-tutorials/robot-browser:latest'
17-
args '--entrypoint=""'
18-
reuseNode true
19-
} }
20-
steps {
21-
sh "robot -d robot_output -l none -r none -o chromium.xml -N Chromium -v URL:${params.URL} --nostatusrc $d/suites/"
22-
// If reuseNode true was not used, we would have to stash the output XML.
23-
// stash includes: 'robot_output/**', name: 'Chromium'
24-
}
25-
}
26-
stage('Firefox') {
27-
agent { docker {
28-
image 'ghcr.io/cicd-tutorials/robot-browser:latest'
29-
args '--entrypoint=""'
30-
reuseNode true
31-
} }
32-
steps {
33-
sh "robot -d robot_output -l none -r none -o b.xml -N Firefox -v URL:${params.URL} --nostatusrc $d/suites/"
34-
// If reuseNode true was not used, we would have to stash the output XML.
35-
// stash includes: 'robot_output/**', name: 'Firefox'
36-
}
37-
}
38-
}
4+
agent any
5+
parameters {
6+
string(
7+
name: 'URL',
8+
defaultValue: '',
9+
description: 'Target URL for the Robot Framework tasks')
10+
}
11+
stages {
12+
stage('Run tasks') {
13+
parallel {
14+
stage('Chromium') {
15+
agent { docker {
16+
image 'ghcr.io/cicd-tutorials/robot-browser:latest'
17+
args '--entrypoint=""'
18+
reuseNode true
19+
} }
20+
steps {
21+
sh "robot -d robot_output -l none -r none -o chromium.xml -N Chromium -v URL:${params.URL} --nostatusrc $d/suites/"
22+
// If reuseNode true was not used, we would have to stash the output XML.
23+
// stash includes: 'robot_output/**', name: 'Chromium'
24+
}
3925
}
40-
stage('Process logs') {
41-
agent { docker {
42-
image 'ghcr.io/cicd-tutorials/robot-browser:latest'
43-
args '--entrypoint=""'
44-
reuseNode true
45-
} }
46-
steps {
47-
// If reuseNode true was not used, we would have to unstash the output XMLs.
48-
// unstash 'Chromium'
49-
// unstash 'Firefox'
50-
sh "rebot -d rebot_output -o output.xml -N '${env.JOB_BASE_NAME} ${BUILD_DISPLAY_NAME}' --nostatusrc robot_output/*.xml"
51-
}
26+
stage('Firefox') {
27+
agent { docker {
28+
image 'ghcr.io/cicd-tutorials/robot-browser:latest'
29+
args '--entrypoint=""'
30+
reuseNode true
31+
} }
32+
steps {
33+
sh "robot -d robot_output -l none -r none -o b.xml -N Firefox -v URL:${params.URL} --nostatusrc $d/suites/"
34+
// If reuseNode true was not used, we would have to stash the output XML.
35+
// stash includes: 'robot_output/**', name: 'Firefox'
36+
}
5237
}
38+
}
5339
}
54-
post {
55-
success {
56-
robot outputPath: 'rebot_output', otherFiles: '**/*.png', onlyCritical: false, passThreshold: 100.0, unstableThreshold: 0.0
57-
}
40+
stage('Process logs') {
41+
agent { docker {
42+
image 'ghcr.io/cicd-tutorials/robot-browser:latest'
43+
args '--entrypoint=""'
44+
reuseNode true
45+
} }
46+
steps {
47+
// If reuseNode true was not used, we would have to unstash the output XMLs.
48+
// unstash 'Chromium'
49+
// unstash 'Firefox'
50+
sh "rebot -d rebot_output -o output.xml -N '${env.JOB_BASE_NAME} ${BUILD_DISPLAY_NAME}' --nostatusrc robot_output/*.xml"
51+
}
52+
}
53+
}
54+
post {
55+
success {
56+
robot outputPath: 'rebot_output', otherFiles: '**/*.png', onlyCritical: false, passThreshold: 100.0, unstableThreshold: 0.0
5857
}
58+
}
5959
}

0 commit comments

Comments
 (0)