forked from StackStorm/st2-auth-ldap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
163 lines (161 loc) · 6.27 KB
/
config.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Setup in CircleCI account the following ENV variables:
# IS_PRODUCTION (default: 0)
# IS_ENTERPRISE (default: 0)
# PACKAGECLOUD_ORGANIZATION (default: stackstorm)
# PACKAGECLOUD_TOKEN
defaults: &defaults
working_directory: ~/ldap
docker:
- image: ruby:2.4.4
version: 2
jobs:
build:
<<: *defaults
environment:
DISTROS: trusty xenial bionic el7 el8
ARTIFACTS: /artifacts
docker_distros: trusty bionic centos7 centos8
docker_run: |-
docker run -w /code/ldap --volumes-from st2-ldap-vol
-e PKG_VERSION=$PKG_VERSION
-e PKG_RELEASE=$PKG_RELEASE
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Install dependencies
command: |
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
apt-get -qq update
apt-get install -y jq rpm
apt-get install -y python-pip python-virtualenv python-dev
apt-get install -y software-properties-common libsasl2-dev libldap2-dev apt-transport-https
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get -qq update
apt-get install -y docker-ce
gem install package_cloud
make .clone_st2_repo
make requirements
mkdir ${ARTIFACTS} && cd ${ARTIFACTS} && mkdir ${DISTROS}
- run:
name: Pull buildpacks
command: |
for dist in $docker_distros; do
docker pull stackstorm/buildpack:$dist
done
echo "<-- BEGIN DOCKER IMAGE LIST -->"
docker image list
echo "<-- END DOCKER IMAGE LIST -->"
- run:
name: Setup circlerc_env
command: |
set -e
.circle/circlerc.sh
source ~/.circlerc
wget -qO - https://github.com/StackStorm/st2-packages/raw/master/.circle/packagecloud.sh > .circle/packagecloud.sh
chmod 755 .circle/packagecloud.sh
PKG_VERSION=$(python setup.py --version 2> /dev/null | sed 's/\.dev[0-9]$/dev/')
PKG_RELEASE=$(.circle/packagecloud.sh next-revision trusty ${PKG_VERSION} st2-auth-ldap)
echo "PKG_VERSION = ${PKG_VERSION}"
echo "PKG_RELEASE = ${PKG_RELEASE}"
echo "export PKG_VERSION=${PKG_VERSION}" >> ~/.circlerc
echo "export PKG_RELEASE=${PKG_RELEASE}" >> ~/.circlerc
- run:
name: Make lint and unit tests
command: |
source virtualenv/bin/activate
make .lint
make .unit-tests
- run:
# Workaround for CircleCI docker-compose limitation where volumes don't work
# See detailed explanation: https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
name: Copy st2-packages files to build containers
command: |
# creating dummy container which will hold a volume with data files
docker create -v /code --name st2-ldap-vol alpine:3.4 /bin/true
# copy st2-packages data files into this volume
docker cp ~/ldap st2-ldap-vol:/code
- run:
name: Build packages for supported distros on native OS inside stackstorm/buildpack container
command: |
source ~/.circlerc
# 1. Build Trusty and Xenial packages
# NOTE: We can re-use the same packages because both distros use same Python 2.7 version
eval ${docker_run} stackstorm/buildpack:trusty make play deb
docker cp st2-ldap-vol:/code/st2-auth-ldap_${PKG_VERSION}-${PKG_RELEASE}_amd64.deb $ARTIFACTS/trusty
docker cp st2-ldap-vol:/code/st2-auth-ldap_${PKG_VERSION}-${PKG_RELEASE}_amd64.changes $ARTIFACTS/trusty
cp $ARTIFACTS/trusty/* $ARTIFACTS/xenial
# 2. Build Bionic packages
eval ${docker_run} stackstorm/buildpack:bionic make play deb
docker cp st2-ldap-vol:/code/st2-auth-ldap_${PKG_VERSION}-${PKG_RELEASE}_amd64.deb $ARTIFACTS/bionic
docker cp st2-ldap-vol:/code/st2-auth-ldap_${PKG_VERSION}-${PKG_RELEASE}_amd64.changes $ARTIFACTS/bionic
# 3. Build RHEL 7 packages
eval ${docker_run} stackstorm/buildpack:centos7 make play rpm
docker cp st2-ldap-vol:/code/ldap/build/x86_64/st2-auth-ldap-${PKG_VERSION}-${PKG_RELEASE}.x86_64.rpm $ARTIFACTS/el7
# 4. Build RHEL 8 packages
eval ${docker_run} stackstorm/buildpack:centos8 make play rpm
docker cp st2-ldap-vol:/code/ldap/build/x86_64/st2-auth-ldap-${PKG_VERSION}-${PKG_RELEASE}.x86_64.rpm $ARTIFACTS/el8
- store_artifacts:
path: /artifacts
- persist_to_workspace:
root: /artifacts
paths:
- trusty
- xenial
- bionic
- el7
- el8
deploy:
<<: *defaults
environment:
ARTIFACTS: /artifacts
DISTROS: trusty xenial bionic el7 el8
steps:
- checkout
- attach_workspace:
at: /artifacts
- run:
name: List workspace files
command: find $ARTIFACTS | sed 's|[^/]*/| |g'
- run:
name: Install dependencies
command: |
set -x
apt-get -qq update
apt-get -y install jq
wget -qO - https://github.com/StackStorm/st2-packages/raw/master/.circle/packagecloud.sh > .circle/packagecloud.sh
chmod 755 .circle/packagecloud.sh
gem install package_cloud
- run:
name: Deploy to packagecloud
command: |
for distro in ${DISTROS}; do
.circle/packagecloud.sh deploy $distro $ARTIFACTS/$distro
done
workflows:
version: 2
build_test_deploy_on_push:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only:
- master
- /v[0-9]+\.[0-9]+/
- feature/circleci
build_test_nightly:
jobs:
- build
triggers:
# Run nightly build for the pack
- schedule:
# NOTE: We run it at 1 am UTC every day
cron: "0 1 * * *"
filters:
branches:
only:
- master