This repository has been archived by the owner on Mar 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.concourse.yml
208 lines (180 loc) · 6.66 KB
/
.concourse.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
resource_types:
- name: copr
type: docker-image
source:
repository: quay.io/ahoi/concourse-copr-resource
resources:
- name: container-fedora
type: docker-image
source:
repository: fedora
tag: latest
max_concurrent_downloads: 2
max_concurrent_uploads: 2
- name: github-upstream-release-resource
type: github-release
check_every: 60m
source:
version: every
release: true
pre_release: true
owner: signalapp
repository: Signal-Desktop
access_token: ((sirmergealot-github-antiratelimit))
- name: github-rpm-release-resource
type: github-release
check_every: 24h
source:
release: true
owner: drahnr
repository: signal-desktop-rpm
access_token: ((sirmergealot-github-token))
- name: git-ci-resource
type: git
source:
branch: master
uri: https://github.com/drahnr/signal-desktop-rpm
- name: git-signal-resource
type: git
source:
branch: master
uri: https://github.com/signalapp/Signal-Desktop
- name: copr-resource
type: copr
source:
login: {{copr-login}}
token: {{copr-token}}
url: {{copr-url}}
- name: rpm-release-dump
type: s3
source:
endpoint: https://minio.spearow.io
bucket: signal-desktop
regexp: signal-desktop-(.*).rpm
access_key_id: {{minio-access-key}}
secret_access_key: {{minio-secret-key}}
jobs:
- name: build-pkg-rpm
public: true
build_logs_to_retain: 3
plan:
- get: release
params: { include_source_tarball: true }
trigger: true
resource: github-upstream-release-resource
- get: container-fedora
trigger: true
- get: spec
resource: git-ci-resource
trigger: true
- get: source
resource: git-signal-resource
trigger: true
- task: create-rpm
timeout: 30m
image: container-fedora
config:
platform: linux
inputs:
- name: release
- name: spec
- name: source
outputs:
- name: srpm
- name: rpm
- name: rpmreleasemeta
run:
path: bash
args:
- -exc
- |
cat /etc/os-release
dnf module install -y nodejs:12
dnf install -y git make gcc gcc-c++ clang cmake rpmdevtools rpmspectool gnupg
REFERENCE_DIR="$(pwd)"
VERSION_WITH_SUFFIX=$(cat release/version)
VERSION=$(echo -n "$VERSION_WITH_SUFFIX" | cut -d "-" -f "1")
VERSION_SUFFIX=$(echo -n "$VERSION_WITH_SUFFIX" | cut -s -d "-" -f "2-")
if [ -z "${VERSION_SUFFIX}" ]; then
echo "release version VERSION_SUFFIX=\"${VERSION_SUFFIX}\""
DOT_VERSION_SUFFIX='%{nil}'
DASH_VERSION_SUFFIX='%{nil}'
else
echo "pre-release version VERSION_SUFFIX=\"${VERSION_SUFFIX}\""
DOT_VERSION_SUFFIX=".${VERSION_SUFFIX}"
DASH_VERSION_SUFFIX="-${VERSION_SUFFIX}"
fi
COMMIT_TAG=$(cat release/tag)
NAME="Signal-Desktop"
NAME_LOWERCASE="$(echo ${NAME} | tr '[:upper:]' '[:lower:]' )"
SPEC_SOURCE_DIR="${REFERENCE_DIR}/spec"
GIT_REPO_DIR="${REFERENCE_DIR}/source"
OUTPUT_RPM_DIR="${REFERENCE_DIR}/rpm"
OUTPUT_SRPM_DIR="${REFERENCE_DIR}/srpm"
pwd 2>&1
RPMBUILD_DIR="${REFERENCE_DIR}/rpmbuild"
# copy all meta info from upstream release to rpmrelease
mkdir -p "${REFERENCE_DIR}/rpmreleasemeta"
cp -rf "${REFERENCE_DIR}/release/"{version,tag,body} "${REFERENCE_DIR}/rpmreleasemeta/"
echo "${NAME}-${VERSION_WITH_SUFFIX}" > "${REFERENCE_DIR}/rpmreleasemeta/name"
mkdir -p "${RPMBUILD_DIR}/"{SOURCES,BUILD,RPMS,SRPMS,SPECS}
#content is not the way github would format it
#cp -v release/source.tar.gz "${RPMBUILD_DIR}/SOURCES/v${VERSION}.tar.gz"
cp -v "${SPEC_SOURCE_DIR}/${NAME_LOWERCASE}.spec" "${RPMBUILD_DIR}/SPECS"
cd "${GIT_REPO_DIR}"
git fetch -f --tags
echo "Using ${COMMIT_TAG} @ ${VERSION_WITH_SUFFIX}"
COMMIT_SHA="$(git rev-parse ${COMMIT_TAG})"
git checkout "${COMMIT_TAG}"
echo "Using ${COMMIT_TAG} -> ${COMMIT_SHA}"
git archive --format=tar --prefix="${NAME}-${VERSION_WITH_SUFFIX}/" HEAD | gzip > "${RPMBUILD_DIR}/SOURCES/v${VERSION_WITH_SUFFIX}.tar.gz"
cd -
cd "${RPMBUILD_DIR}"
ls -al SOURCES
curl --slient --location https://rpm.nodesource.com/setup_12.x | sudo -E bash -
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
# explicitly install modules first, so far there is no
# way to combined this with builddep/spectool
dnf install -y 'dnf-command(builddep)'
dnf builddep -y "SPECS/${NAME_LOWERCASE}.spec"
# prep for signing
echo "%_signature gpg" > $HOME/.rpmmacros
echo "%_gpg_name Bernhard Schuster" >> $HOME/.rpmmacros
# FIXME, do not run as root
rpmbuild \
--define "_topdir ${RPMBUILD_DIR}" \
--define "_builddir %{_topdir}/BUILD" \
--define "_rpmdir %{_topdir}/RPMS" \
--define "_srcrpmdir %{_topdir}/SRPMS" \
--define "_specdir %{_topdir}/SPECS" \
--define "_sourcedir %{_topdir}/SOURCES" \
--define "upstream_version ${VERSION}" \
--define "dot_version_suffix ${DOT_VERSION_SUFFIX}" \
--define "dash_version_suffix ${DASH_VERSION_SUFFIX}" \
-ba "SPECS/${NAME_LOWERCASE}.spec" || exit 1
mkdir -p "${OUTPUT_RPM_DIR}" "${OUTPUT_SRPM_DIR}"
rm -vf ${RPMBUILD_DIR}/RPMS/x86_64/${NAME_LOWERCASE}-*debug*.rpm
cp -vf ${RPMBUILD_DIR}/RPMS/x86_64/${NAME_LOWERCASE}-*.rpm "${OUTPUT_RPM_DIR}"
cp -vf ${RPMBUILD_DIR}/SRPMS/${NAME_LOWERCASE}-*.src.rpm "${OUTPUT_SRPM_DIR}"
- put: rpm-release-dump
params:
file: rpm/signal-desktop*.rpm
acl: public-read
- put: github-rpm-release
resource: github-rpm-release-resource
params:
name: rpmreleasemeta/name
tag: rpmreleasemeta/tag
body: rpmreleasemeta/body
globs:
- rpm/*.rpm
- srpm/*.src.rpm
- put: copr
resource: copr-resource
params:
rpmbuild_dir: "srpm"
chroots: ["fedora-rawhide-x86_64", "fedora-29-x86_64"]
enable_net: false
max_n_bytes: 250000000
project_id: 18368
regex: ".*signal-desktop-.*\\.src\\.rpm$"