Skip to content

Commit 97ad198

Browse files
authored
Merge pull request #287 from skhoroshavin/rc-1.0.1
ST-609: RC 1.0.1
2 parents e307260 + 13e4b8b commit 97ad198

93 files changed

Lines changed: 1401 additions & 1243 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ lib64/
2323
parts/
2424
sdist/
2525
var/
26+
tails/
2627
*.egg-info/
2728
.installed.cfg
2829
*.egg

devops/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ifeq ($(SRC_DIR_NAME),sovtoken)
5353
# pypi: indy-plenum
5454
# apt: indy-plenum (stable component)
5555

56-
FPM_P_DEPENDS := indy-node(=1.9.0)
56+
FPM_P_DEPENDS := indy-node(=1.9.1~rc1)
5757
FPM_ARGS := --no-python-dependencies $(FPM_ARGS)
5858
endif
5959

devops/aws-codebuild/Jenkinsfile.cd

Lines changed: 139 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,34 @@ def sovLibrary = library(identifier: 'sovrin-aws-codebuild@v1.0.1', retriever: m
66
github(credentialsId: 'sovbot-github', repoOwner: 'sovrin-foundation', repository: 'aws-codebuild-pipeline-plugin')
77
)).com.sovrin.pipeline
88

9+
def getParam(name) {
10+
return (params."$name" ?: env."$name")
11+
}
12+
13+
def getApprove(name) {
14+
def approval
15+
try {
16+
input(message: 'Do you want to publish this package?')
17+
approval = true
18+
echo "$name approval granted"
19+
}
20+
catch (Exception err) {
21+
approval = false
22+
echo "$name approval denied"
23+
}
24+
return approval
25+
}
26+
927
logger = sovLibrary.Logger.new(this)
1028
notifier = sovLibrary.Notifier.new(this)
29+
utils = sovLibrary.Utils.new(this)
1130
logger.setGlobalLevel('TRACE')
1231

13-
gitHubUserCredId = env.GITHUB_BOT_USER ?: 'sovbot-github'
14-
sovrinPackagingRepo = env.SOVRIN_PACKAGING_REPO ?: 'https://github.com/sovrin-foundation/sovrin-packaging'
15-
sovrinPackagingBranch = env.SOVRIN_PACKAGING_BRANCH ?: 'master'
16-
17-
def downloadPackagingUtils() {
18-
git branch: sovrinPackagingBranch, credentialsId: gitHubUserCredId, url: sovrinPackagingRepo
19-
sh "pip3 install -U plumbum deb-pkg-tools"
20-
}
32+
String gitHubUserCredId = getParam('GITHUB_BOT_USER') ?: 'sovbot-github'
33+
String sovrinPackagingRepo = getParam('env.SOVRIN_PACKAGING_REPO') ?: 'https://github.com/sovrin-foundation/sovrin-packaging'
34+
String sovrinPackagingBranch = getParam('SOVRIN_PACKAGING_BRANCH') ?: 'master'
35+
String repoName = getParam('SOVRIN_CORE_REPO_NAME') ?: 'core'
36+
String repoComponent = getParam('SOVRIN_CORE_REPO_CHANNEL') ?: env.BRANCH_NAME ?: 'master'
2137

2238
def nodeLabels = [
2339
codeBuild: env.LIBSOVTOKEN_CODEBUILD_NODE_LABEL ?: 'codebuild',
@@ -30,35 +46,71 @@ pipelineWrapper({
3046
//this IP is outdated, should use the one from env
3147
// env.SOVRIN_REPO_HOST = '192.168.11.115'
3248

49+
Boolean isRC = false
50+
Boolean isRelease = false
51+
Boolean isDev = (env.BRANCH_NAME == 'master')
52+
List pkgsList = []
53+
String debsDir = 'debs'
54+
String pkgUtilsDir = 'sovrin-packaging'
55+
56+
Closure _upload = {
57+
logger.info("Uploading debian packages to '${repoName}/${repoComponent}' sovrin repo: $pkgsList")
58+
String u_id = utils.shStdout('id -u')
59+
docker.build(
60+
"$projectName:debs-upload",
61+
"--build-arg=u_id=$u_id -f devops/docker/cd/debs_upload.dockerfile devops/docker/cd"
62+
).inside {
63+
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) {
64+
sh """
65+
./$pkgUtilsDir/upload_debs.py $debsDir $repoName $repoComponent --host $env.SOVRIN_REPO_HOST --ssh-key $sovrin_key
66+
"""
67+
}
68+
}
69+
}
70+
71+
Closure _notify = {
72+
notifier.email {
73+
to = '$DEFAULT_RECIPIENTS ' + (this.env.LIBSOVTOKEN_DEF_RECIPIENTS ?: '')
74+
subject = "[$projectName] new packages ${pkgsList.join(' ')} published to '${repoName}/${repoComponent}' repo"
75+
body = """
76+
|New debian packages ${pkgsList.join(' ')} were built and published to '${repoName}/${repoComponent}' repo
77+
|
78+
|Build:
79+
| Project: \$PROJECT_NAME
80+
| Url: ${this.env.BUILD_URL}
81+
| Number: ${this.env.BUILD_NUMBER}
82+
|
83+
|Check console output at ${this.env.BUILD_URL}console to view the details.
84+
""".stripMargin()
85+
}
86+
}
87+
3388
nodeWrapper(nodeLabels.codeBuild) {
3489
def osname = 'xenial'
3590
List projects = ['sovtoken', 'sovtokenfees']
36-
List pkgsList = []
3791
String indyNodeVersion
38-
Boolean isRC = false
39-
Boolean isRelease = false
40-
Boolean isDev = (env.BRANCH_NAME == 'master')
41-
42-
stage('Checkout sources from SCM') {
43-
checkout scm
44-
}
4592

4693
def sovrinRepo = sovLibrary.SovrinRepo.new(this)
47-
def utils = sovLibrary.Utils.new(this)
4894
def buildCtx = sovLibrary.AwsCodeBuildHelper.BuildCtx.new('plugin',
4995
['devops', 'sovtoken/sovtoken/__metadata__.py', 'sovtokenfees/sovtokenfees/__metadata__.py'])
5096
def awsCBHelper = sovLibrary.AwsCodeBuildHelper.new(this, buildCtx)
5197

52-
stage('Get indy-node version') {
98+
stage('Checkout sources from SCM') {
99+
checkout scm
100+
}
101+
102+
stage('Set release params') {
53103
indyNodeVersion = utils.shStdout("""
54104
sed -n "s/.*indy-node==\\([^\\"\\']\\+\\).*/\\1/p" sovtoken/setup.py
55105
""")
56106
if (!indyNodeVersion) {
57107
throw new Exception('indy-node version is not found')
58108
}
59-
isRC = !!((env.BRANCH_NAME == 'stable') && indyNodeVersion.find(/[^0-9\.]/))
60-
isRelease = ((env.BRANCH_NAME == 'stable') && !isRC)
61-
logger.info("Detected indy-node version: '$indyNodeVersion', isRC: $isRC, isRelease: $isRelease")
109+
logger.info("Detected indy-node version: '$indyNodeVersion'")
110+
111+
isRC = (env.BRANCH_NAME == 'stable')
112+
isRelease = !!(isRC && !indyNodeVersion.find(/[^0-9\.]/))
113+
logger.info("Release parameters: isRC: $isRC, isRelease: $isRelease")
62114
}
63115

64116
Map builds = [
@@ -102,20 +154,21 @@ pipelineWrapper({
102154
logger.info("Current source version: $srcVersion")
103155
}
104156

105-
// stage('Get last revision') {
106-
// lastRevision = evernymRepo.getLastRevision {
107-
// delegate.packageName = packageName
108-
// packageSrcVersion = srcVersion
109-
// repoDistr = 'agency-dev'
110-
// }
111-
//
112-
// if (lastRevision) {
113-
// logger.info("Found last revision number: $lastRevision")
114-
// } else {
115-
// logger.info("No previous revision was found")
116-
// }
117-
// }
157+
/*
158+
stage('Get last revision') {
159+
lastRevision = evernymRepo.getLastRevision {
160+
delegate.packageName = packageName
161+
packageSrcVersion = srcVersion
162+
repoDistr = 'agency-dev'
163+
}
118164
165+
if (lastRevision) {
166+
logger.info("Found last revision number: $lastRevision")
167+
} else {
168+
logger.info("No previous revision was found")
169+
}
170+
}
171+
*/
119172

120173
stage('Set release parameters') {
121174
def releaseVersion = isRelease ? '' : (isRC ? 'rc' : isDev ? 'dev' : '') + "$BUILD_NUMBER"
@@ -158,14 +211,14 @@ pipelineWrapper({
158211

159212
onArtifacts = {
160213
this.stage("$projLabel: Archive logs") {
161-
utils.archiveArtifacts("logs/*.log*") {
214+
this.utils.archiveArtifacts("logs/*.log*") {
162215
truncate = true
163216
allowEmptyArchive = true
164217
}
165218

166219
String pkgBaseName = "${packageName}_${debPVersion}"
167220

168-
this.stash includes: utils.shStdout("ls ${pkgBaseName}_*.deb"), name: pkgBaseName
221+
this.stash includes: this.utils.shStdout("ls ${pkgBaseName}_*.deb"), name: pkgBaseName
169222
pkgsList += pkgBaseName
170223
}
171224
}
@@ -177,48 +230,69 @@ pipelineWrapper({
177230
stage("Build artifacts") {
178231
builds.failFast = false
179232
utils.parallel builds
180-
}
181-
182-
stage('Release artifacts') {
183-
String repoName = env.SOVRIN_CORE_REPO_NAME
184-
String repoComponent = env.BRANCH_NAME
185-
String debsDir = 'debs'
186-
187-
if (isRC) {
188-
repoComponent = 'rc'
189-
}
190-
logger.info("Debian repo component is set to: '$repoComponent'")
191233

192234
dir(debsDir) {
193235
pkgsList.each {
194236
unstash name: it
195237
}
196238
}
197-
logger.info("Uploading debian packages to '${repoName}/${repoComponent}' sovrin repo: $pkgsList")
239+
sh "ls -la $debsDir"
240+
}
198241

199-
dir("sovrin-packaging") {
200-
downloadPackagingUtils()
242+
stage("Get packaging utils") {
243+
dir(pkgUtilsDir) {
244+
git branch: sovrinPackagingBranch, credentialsId: gitHubUserCredId, url: sovrinPackagingRepo
201245
}
246+
}
202247

203-
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) {
204-
sh "./sovrin-packaging/upload_debs.py $debsDir $repoName $repoComponent --host $env.SOVRIN_REPO_HOST --ssh-key $sovrin_key --force-backup"
248+
if (isRC) {
249+
repoComponent = 'rc'
250+
}
251+
252+
stage("Publish to $repoComponent") {
253+
_upload()
254+
if (isRelease) {
255+
stash includes: "$pkgUtilsDir/**/*", name: pkgUtilsDir
256+
stash includes: "$debsDir/**/*", name: debsDir
257+
}
258+
}
259+
}
260+
261+
stage("Notify about $repoComponent") {
262+
_notify()
263+
}
264+
265+
if (isRelease) {
266+
Boolean approval = false
267+
repoComponent = 'stable'
268+
269+
stage("QA approval") {
270+
approval = getApprove("QA")
271+
}
272+
273+
if (!approval) {
274+
return
275+
}
276+
277+
nodeWrapper('ubuntu') {
278+
stage('Checkout sources from SCM') {
279+
checkout scm
205280
}
206281

207-
notifier.email {
208-
to = '$DEFAULT_RECIPIENTS ' + (this.env.LIBSOVTOKEN_DEF_RECIPIENTS ?: '')
209-
subject = "[$projectName] new packages ${pkgsList.join(' ')} published to '${repoName}/${repoComponent}' repo"
210-
body = """
211-
|New debian packages ${pkgsList.join(' ')} were built and published to '${repoName}/${repoComponent}' repo
212-
|
213-
|Build:
214-
| Project: \$PROJECT_NAME
215-
| Url: ${this.env.BUILD_URL}
216-
| Number: ${this.env.BUILD_NUMBER}
217-
|
218-
|Check console output at ${this.env.BUILD_URL}console to view the details.
219-
""".stripMargin()
282+
// Note. it is assumed here that packages are already in a backup
283+
// directory and their upload would be actually skipped since '--force-backup'
284+
// is not used
285+
stage("Publish to $repoComponent") {
286+
unstash pkgUtilsDir
287+
unstash debsDir
288+
289+
_upload()
220290
}
221291
}
292+
293+
stage("Notify about $repoComponent") {
294+
_notify()
295+
}
222296
}
223297
}, { err ->
224298
if (err) {

devops/build-scripts/xenial/Pool_Party/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ARG sovtokenfees_pkg_name=sovtokenfees_0.9.6_amd64.deb
6262
COPY ${sovtoken_pkg_name} /root
6363
COPY ${sovtokenfees_pkg_name} /root
6464

65-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
65+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
6666
RUN echo "deb https://repo.sovrin.org/deb xenial $indy_stream" >> /etc/apt/sources.list
6767

6868
RUN apt-get update -y && apt-get install -y \

devops/denv/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apt-get update -y && apt-get install -y \
99
apt-transport-https \
1010
ca-certificates
1111

12-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
12+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
1313

1414
RUN echo "deb https://repo.sovrin.org/sdk/deb xenial stable" >> /etc/apt/sources.list
1515

@@ -59,7 +59,7 @@ WORKDIR /home/indy
5959
# indy-node along with supervisor
6060
ENV INDY_NODE_VERSION ${INDY_NODE_VERSION:-1.7.1}
6161
ARG indy_plenum_ver=1.7.1
62-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
62+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
6363
RUN echo "deb https://repo.sovrin.org/deb xenial rc" >> /etc/apt/sources.list \
6464
&& apt-get update && apt-get install -y \
6565
supervisor \
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ubuntu:xenial
2+
3+
# debian packages
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
ssh \
6+
python3.5 \
7+
python3-pip \
8+
python-setuptools \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# pypi based packages
12+
# issues with pip>=10:
13+
# https://github.com/pypa/pip/issues/5240
14+
# https://github.com/pypa/pip/issues/5221
15+
RUN python3 -m pip install -U \
16+
pip \
17+
setuptools \
18+
virtualenv \
19+
pipenv \
20+
plumbum \
21+
deb-pkg-tools \
22+
&& pip3 list
23+
24+
# user
25+
ARG u_id=1000
26+
ARG u_name=user
27+
28+
RUN if [ "$u_id" != "0" ]; then \
29+
useradd -ms /bin/bash -u $u_id $u_name; \
30+
fi

devops/docker/ci/xenial/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y \
1010
&& rm -rf /var/lib/apt/lists/*
1111

1212
# rocksdb
13-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88 \
13+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \
1414
&& add-apt-repository "deb https://repo.sovrin.org/deb xenial rc master" \
1515
&& apt-get update && apt-get install -y \
1616
libbz2-dev \
@@ -44,4 +44,4 @@ RUN if [ "$u_id" != "0" ]; then \
4444
USER $u_id
4545

4646
# TODO CMD ENTRYPOINT ...
47-
ENV CI_ENV_VERSION=0.18.0
47+
ENV CI_ENV_VERSION=0.19.0

devops/vagrant/desktop/scripts/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sudo apt-get update -y && apt-get install -y \
1111
apt-transport-https \
1212
ca-certificates
1313

14-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
14+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
1515

1616
echo "deb https://repo.sovrin.org/sdk/deb xenial stable" >> /etc/apt/sources.list
1717

docs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Sovtokenfees
2+
3+
The following documents provide necessary information regarding fees:
4+
5+
* [Sovtokenfees Data Structures](./fees_data_structures.md)
6+
* [Fees related auth_rule](./fees_auth_rules.md)
7+
* [Setting fees process](https://github.com/sovrin-foundation/libsovtoken/blob/master/doc/fees.md)
File renamed without changes.

0 commit comments

Comments
 (0)