-
Notifications
You must be signed in to change notification settings - Fork 151
/
hello-world.lit
129 lines (100 loc) · 3.98 KB
/
hello-world.lit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
\title{Hello, world!}{hello-world}
\use-plugin{concourse-docs}
Once you've got your Concourse all \reference{setting-up}{set up}, you'll want
to download \reference{fly-cli}{the Fly CLI} from your instance via the web UI.
You can find the download links by browsing to the main page:
\tutorial-image{images/hello-cli-downloads.png}
If you're on Linux or OS X, you will have to \code{chmod +x}
the downloaded binary and put it in your \code{$PATH}. This
can be done in one fell swoop with \code{install path/to/fly
/usr/local/bin/fly}
Throughout this page we'll assume you've spun up the
\reference{concourse-lite}{Concourse Lite VM}, but if you've set up Concourse
in some other way, everything still applies; just use your URL instead of
\code{http://192.168.100.4:8080}.
Once you have \code{fly}, you'll want to target your local VirtualBox like so:
\codeblock{bash}{{
$ fly -t lite login -c http://192.168.100.4:8080
}}
This will save the target as \code{lite}, which we'll use for all later
commands that we want to run against the local box by using the same \code{-t}
flag.
Out of the box, Concourse doesn't have any \reference{pipelines} configured.
That's boring. Here, have this YAML!
\titled-codeblock{hello.yml}{yaml}{{{
jobs:
- name: hello-world
plan:
- task: say-hello
config:
platform: linux
image_resource:
type: docker-image
source: {repository: ubuntu}
run:
path: echo
args: ["Hello, world!"]
}}}
Dump that into a file called \code{hello.yml}, and run the following:
\codeblock{bash}{{
$ fly -t lite set-pipeline -p hello-world -c hello.yml
}}
If you refresh the \link{main page}{http://192.168.100.4:8080}, you should
now see the world's tiniest \reference{pipelines}{pipeline}!
\tutorial-image{images/hello-pipeline-1.png}
Newly configured pipelines are paused by default (indicated by the blue bar
along top of the page), to prevent them from running freely when you're not
sure what they do yet. To unpause it, you can either reveal the pipelines
sidebar via the \font-awesome{fa-bars} button in the top left and press
\font-awesome{fa-play}, or run:
\codeblock{bash}{{
$ fly -t lite unpause-pipeline -p hello-world
}}
You can always fetch the current configuration of a pipeline by running:
\codeblock{bash}{{
$ fly -t lite get-pipeline -p hello-world
}}
This pipeline configuration so far describes a single \reference{jobs}{job},
whose \reference{build-plans}{\code{plan}} has a single
\reference{running-tasks}{task}. There are no resources for this job to
automatically trigger so we'll have to give it a helping hand. Click the job
and then press the \font-awesome{fa-plus-circle} button in the top right. The
task boots up, prints \code{Hello, world!}, and completes successfully:
\tutorial-image{images/hello-build.png}
Let's spice things up a bit. A pipeline with a single job with no resources
isn't very interesting, so let's add a simple resource in the form of a timed
trigger, using the \link{Time
resource}{https://github.com/concourse/time-resource}.
\titled-codeblock{navi-pipeline.yml}{yaml}{{{
resources:
- name: every-1m
type: time
source: {interval: 1m}
jobs:
- name: navi
plan:
- get: every-1m
trigger: true
- task: annoy
config:
platform: linux
image_resource:
type: docker-image
source: {repository: ubuntu}
run:
path: echo
args: ["Hey! Listen!"]
}}}
Run the following to reconfigure the existing pipeline:
\codeblock{bash}{{
$ fly -t lite set-pipeline -p hello-world -c navi-pipeline.yml
}}
Your pipeline should now look like this:
\tutorial-image{images/hello-pipeline-2.png}
Every minute, the \code{every-1m} resource will yield a new version. This
resource is used in a \reference{get-step} step in the \code{navi} job, which
sets \reference{get-step-trigger} to \code{true}, so as a result the job will
run every minute.
Now may be a good time to start learning about the
\reference{resource-types}{different types of resources} or start looking at
\reference{tutorials}.