forked from vmware-archive/concourse-pipeline-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.yml
70 lines (67 loc) · 2.01 KB
/
pipeline.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
---
resource_types:
- name: azure-blob
type: docker-image
source:
repository: cfcloudops/azure-blobstore-concourse-resource
resources:
- name: azure-blobstore
type: azure-blob
source:
storage_account_name: REPLACE-WITH-YOUR-BLOBSTORE-ACCOUNT-NAME
storage_access_key: REPLACE-WITH-YOUR-BLOBSTORE-ACCESS-KEY
container: REPLACE-WITH-YOUR-BLOBSTORE-CONTAINER-NAME
regexp: REPLACE-WITH-YOUR-FILES-NAME-AND-VERSION-REGEX # e.g. myapp-release-([0-9\.]+).tar.gz
environment: AzureCloud
jobs:
- name: 1-build-and-save-release-to-blobstore
plan:
- task: create-artifact
config:
platform: linux
image_resource:
type: docker-image
source:
repository: ubuntu
outputs:
- name: build
run:
path: sh
args:
- -exc
- |
# Do your build steps here. Creating temporary file below as a sample:
export CURRENT_TIMESTAMP=$(date +"%Y%m%d%H%S")
echo "Sample build output file, timestamp: $CURRENT_TIMESTAMP" > ./build/myappfile.txt
# Creating sample package file with a file name containing the new version number
tar -cvzf ./myapp-release-$CURRENT_TIMESTAMP.tar.gz --directory=./build .
mv ./myapp-release-*.tar.gz ./build
find .
- put: azure-blobstore
params: { file: ./build/myapp-release-*.tar.gz }
- name: 2-trigger-when-new-file-is-added-to-azure-blobstore
plan:
- get: azure-blobstore
trigger: true
passed:
- 1-build-and-save-release-to-blobstore
- task: use-new-file
config:
platform: linux
image_resource:
type: docker-image
source:
repository: ubuntu
inputs:
- name: azure-blobstore
run:
path: sh
args:
- -exc
- |
cd ./azure-blobstore
ls -la
echo "Version of release file retrieved: $(cat ./version). Extracting release file..."
tar -xvf ./myapp-release-*.tar.gz
ls -la
cat ./myappfile.txt