forked from flenter/getting-started-golang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wercker.yml
81 lines (81 loc) · 3.16 KB
/
wercker.yml
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
dev:
box:
id: golang
ports:
- "5000"
steps:
- internal/watch:
code: |
# If we had any dependencies we would need to re-run glide, dep or whatever
echo "Building...."
go build ./...
./source
reload: true
build:
box: google/golang
steps:
# Test the project
- script:
name: go test
code: go test ./...
# Statically build the project
- script:
name: go build
code: |
CGO_ENABLED=0 go build -a -ldflags '-s' -installsuffix cgo -o myapp .
echo Verifying build
pwd
ls -l
# Copy binary to location that gets passed along to next pipeline (WERCKER_OUTPUT_DIR is /pipeline/output)
- script:
name: copy binary
code: |
cp myapp "$WERCKER_OUTPUT_DIR"
echo $WERCKER_OUTPUT_DIR
ls -l $WERCKER_OUTPUT_DIR
- script:
name: Add sentinels
code: |
touch /pipeline/file-added-to-slash-pipeline
touch $WERCKER_ROOT/file-added-to-wercker-root
touch $WERCKER_OUTPUT_DIR/file-added-to-wercker-output_dir
touch $WERCKER_CACHE_DIR/file-added-to-wercker-cache_dir
- script:
name: Check what we've got # looks like pipeline/output ($WERCKER_OUTPUT_DIR) is not copied to next pipeline, but /pipeline/source ($WERCKER_ROOT) is not
code: |
echo Contents of /pipeline
ls -l /pipeline
echo Contents of WERCKER_ROOT=$WERCKER_ROOT
ls -l $WERCKER_ROOT
echo Contents of WERCKER_OUTPUT_DIR=$WERCKER_OUTPUT_DIR
ls -l $WERCKER_OUTPUT_DIR
echo Contents of WERCKER_CACHE_DIR=$WERCKER_CACHE_DIR
ls -l $WERCKER_CACHE_DIR
echo WERCKER_GIT_COMMIT=$WERCKER_GIT_COMMIT
echo WERCKER_GIT_REPOSITORY=$WERCKER_GIT_REPOSITORY
pipeline2:
box: google/golang
steps:
- script:
name: Check what we've got # looks like pipeline/output ($WERCKER_OUTPUT_DIR) is not copied to next pipeline, but /pipeline/source ($WERCKER_ROOT) is not
code: |
echo Contents of /pipeline
ls -l /pipeline
echo Contents of WERCKER_ROOT=$WERCKER_ROOT
ls -l $WERCKER_ROOT
echo Contents of WERCKER_OUTPUT_DIR=$WERCKER_OUTPUT_DIR
ls -l $WERCKER_OUTPUT_DIR
echo Contents of WERCKER_CACHE_DIR=$WERCKER_CACHE_DIR
ls -l $WERCKER_CACHE_DIR
echo WERCKER_GIT_COMMIT=$WERCKER_GIT_COMMIT
echo WERCKER_GIT_REPOSITORY=$WERCKER_GIT_REPOSITORY
- internal/docker-push: # Creates 220MB image
tag: wcr-maximal-samepipe
cmd: /pipeline/source/myapp
ports: "5000"
#repository: wcr.io/nigeldeakin/getting-started-golang # can be omitted when the build runs on wercker.com
- internal/docker-scratch-push: # Creates 1.43MB image
tag: wcr-minimal-samepipe
cmd: /myapp # when creating a minimal image, files in /pipeline/output are copied to / in the new scratch image
ports: "5000"
#repository: wcr.io/nigeldeakin/getting-started-golang # can be omitted when the build runs on wercker.com