-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
113 lines (106 loc) · 4.12 KB
/
.gitlab-ci.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
variables:
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
PACKAGE_NAME: pam-handshake
stages:
- pull
- make
- publish
before_script:
- rm -f .variables
- touch .variables
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY;
- echo export DOCKER_IMAGE=git.ia.surfsara.nl:5050/data-management-services/irods-ci-server/centos7_4_2_7:latest >> .variables
- echo export VERSION=0.1.0 >> .variables
- echo export MODULE_VERSION=0.1.0 >> .variables
- echo export IRODS_VERSIONS=4.2.7,4.2.8 >> .variables
- echo export PACKAGE_NAME=pam-handshake >> .variables
- echo export MODULE_PACKAGE_NAME=python-pam-module >> .variables
- echo export REPO=DMS-RPM-Testing,DMS-RPM-Testing-Public >> .variables
docker_pull:
stage: pull
tags:
- irods
script:
- source .variables
- docker pull $DOCKER_IMAGE
make:
stage: make
tags:
- irods
script:
- source .variables
- |
for IRODS_VERSION in ${IRODS_VERSIONS//,/$'\n'}
do
export TARGET_DIR=/data/RPMS/$CI_PROJECT_NAMESPACE/$CI_COMMIT_REF_NAME/CentOS/7/irods-$IRODS_VERSION
mkdir -p $TARGET_DIR
docker rm build_pam_handshake || true
docker run --name build_pam_handshake -u rpmbuild -v$( pwd):/build \
--entrypoint "" $DOCKER_IMAGE /home/rpmbuild/build_rpm.sh \
--irods-version ${IRODS_VERSION} \
--spec-file /build/pam_handshake.spec \
--package ${PACKAGE_NAME} \
--version $VERSION \
--release ${CI_PIPELINE_ID}
docker cp build_pam_handshake:/home/rpmbuild/rpmbuild/RPMS/x86_64 $TARGET_DIR
docker rm build_pam_handshake
done
make_python_pam_modules:
stage: make
tags:
- irods
script:
- source .variables
- |
for IRODS_VERSION in ${IRODS_VERSIONS//,/$'\n'}
do
export TARGET_DIR=/data/RPMS/$CI_PROJECT_NAMESPACE/$CI_COMMIT_REF_NAME/CentOS/7/irods-$IRODS_VERSION
mkdir -p $TARGET_DIR
docker rm build_python_pam_modules || true
docker run --name build_python_pam_modules -u rpmbuild -v$( pwd):/build \
--entrypoint "" $DOCKER_IMAGE /home/rpmbuild/build_rpm.sh \
--irods-version ${IRODS_VERSION} \
--spec-file /build/python_pam_module.spec \
--package ${MODULE_PACKAGE_NAME} \
--version ${MODULE_VERSION} \
--release ${CI_PIPELINE_ID}
docker cp build_python_pam_modules:/home/rpmbuild/rpmbuild/RPMS/x86_64 $TARGET_DIR
docker rm build_python_pam_modules
done
publish:
stage: publish
tags:
- irods
script:
- source .variables
- |
for IRODS_VERSION in ${IRODS_VERSIONS//,/$'\n'}
do
TARGET_DIR=/data/RPMS/$CI_PROJECT_NAMESPACE/$CI_COMMIT_REF_NAME/CentOS/7/irods-$IRODS_VERSION/x86_64
RPM=${PACKAGE_NAME}-${VERSION}-${CI_PIPELINE_ID}.x86_64.rpm
TRPM=${PACKAGE_NAME}-${VERSION}-${CI_PIPELINE_ID}.x86_64.rpm
REMOTE_TARGET_DIR=Centos/7/irods-$IRODS_VERSION/$CI_COMMIT_REF_NAME/x86_64/Packages
for IREPO in $( echo ${REPO} | tr ',' ' ' )
do
curl -H "X-JFrog-Art-Api:$ARTIE_KEY" -XPUT https://artie.ia.surfsara.nl/artifactory/${IREPO}/${REMOTE_TARGET_DIR}/${TRPM} -T $TARGET_DIR/${RPM}
done
done
publish_python_pam_modules:
stage: publish
tags:
- irods
script:
- source .variables
- |
for IRODS_VERSION in ${IRODS_VERSIONS//,/$'\n'}
do
TARGET_DIR=/data/RPMS/$CI_PROJECT_NAMESPACE/$CI_COMMIT_REF_NAME/CentOS/7/irods-$IRODS_VERSION/x86_64
RPM=${MODULE_PACKAGE_NAME}-${MODULE_VERSION}-${CI_PIPELINE_ID}.x86_64.rpm
TRPM=${MODULE_PACKAGE_NAME}-${MODULE_VERSION}-${CI_PIPELINE_ID}.x86_64.rpm
REMOTE_TARGET_DIR=Centos/7/irods-$IRODS_VERSION/$CI_COMMIT_REF_NAME/x86_64/Packages
for IREPO in $( echo ${REPO} | tr ',' ' ' )
do
curl -H "X-JFrog-Art-Api:$ARTIE_KEY" -XPUT https://artie.ia.surfsara.nl/artifactory/${IREPO}/${REMOTE_TARGET_DIR}/${TRPM} -T $TARGET_DIR/${RPM}
done
done