-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
157 lines (151 loc) · 5.19 KB
/
Jenkinsfile
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
pipeline {
agent { label 'monarch-agent-xlarge' }
environment {
HOME = "${env.WORKSPACE}"
RELEASE = sh(script: "echo `date +%Y-%m-%d`", returnStdout: true).trim()
BUILD_TIMESTAMP = sh(script: "echo `date +%s`", returnStdout: true).trim()
PATH = "/opt/poetry/bin:${env.PATH}"
AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY')
GH_RELEASE_TOKEN = credentials('GH_RELEASE_TOKEN')
}
stages {
stage('setup') {
steps {
sh '''
echo "Current directory: \\$(pwd)"
# export PATH=$PATH:$HOME/.local/bin
echo "Path: $PATH"
# echo $SHELL
python3 --version
pip --version
poetry --version
# poetry config experimental.new-installer false
poetry install --with dev
poetry run which ingest
# temporarily disabling, there isn't a .boto file
# create & edit ~/.boto to include AWS credentials
# sed -i "s@<your aws access key ID>@$(AWS_ACCESS_KEY_ID)@g" ~/.boto
# sed -i "s@<your aws secret access key>@$(AWS_SECRET_ACCESS_KEY)@g" ~/.boto
'''
}
}
stage('download') {
steps {
sh '''
mkdir data || true
gsutil -q -m cp -r gs://monarch-ingest-data-cache/* data/
ls -lafs
ls -la data
'''
}
}
stage('transform') {
steps {
sh 'poetry run ingest transform --all --log --rdf --write-metadata'
sh '''
sed -i.bak 's@\r@@g' output/transform_output/*.tsv
rm output/transform_output/*.bak
'''
sh '''
gunzip output/rdf/*.gz
sed -i.bak 's@\\r@@g' output/rdf/*.nt
rm output/rdf/*.bak
gzip output/rdf/*.nt
'''
}
}
stage('merge') {
steps {
sh 'poetry run ingest merge'
}
}
stage('denormalize') {
steps {
sh 'poetry run ingest closure'
}
}
stage('report') {
steps {
sh 'poetry run ingest report'
}
}
stage('kgx-graph-summary') {
steps {
sh 'poetry run kgx graph-summary -i tsv -c "tar.gz" --node-facet-properties provided_by --edge-facet-properties provided_by output/monarch-kg.tar.gz -o output/merged_graph_stats.yaml'
}
}
stage('jsonl-conversion'){
steps {
sh 'poetry run ingest jsonl'
}
}
stage('solr') {
steps {
sh 'poetry run ingest solr'
}
}
stage('kgx-transforms'){
steps {
sh './scripts/kgx_transforms.sh'
}
}
stage('sqlite') {
steps {
sh 'poetry run ingest sqlite'
}
}
stage('make exports') {
steps {
sh 'poetry run ingest export'
}
}
stage('prepare release') {
steps {
sh 'poetry run ingest prepare-release'
}
}
stage('upload files') {
steps {
sh 'poetry run ingest release --kghub'
}
}
stage('create github release') {
steps {
sh 'poetry run python scripts/create_github_release.py --kg-version ${RELEASE}'
}
}
stage('update dev deployment') {
steps {
sh 'poetry run python scripts/update-dev-solr.py'
}
}
stage('index') {
steps {
sh '''
echo "Current directory: $(pwd)"
python3 --version
pip --version
export PATH=$HOME/.local/bin:$PATH
echo "Path: $PATH"
cd $HOME
mkdir data-public
gcsfuse --implicit-dirs data-public-monarchinitiative data-public
git clone https://github.com/monarch-initiative/monarch-file-server.git
pip install -r monarch-file-server/scripts/requirements.txt
python3 monarch-file-server/scripts/directory_indexer.py --inject monarch-file-server/scripts/directory-index-template.html --directory data-public --prefix https://data.monarchinitiative.org -x
'''
}
}
}
post {
always {
sh 'docker rm -f neo || true'
// sh 'docker rm my_solr || true'
}
// upload data and output on failure
failure {
sh 'gsutil cp -r . gs://monarch-archive/monarch-kg-failed/${RELEASE}-${BUILD_TIMESTAMP}'
}
}
}