This repository was archived by the owner on Nov 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpublish.sh
executable file
·121 lines (101 loc) · 4.81 KB
/
publish.sh
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
#!/bin/bash
set -xeu
ARCHWAY_VERSION=${ARCHWAY_VERSION:-$BITBUCKET_TAG}
ARCHWAY_VERSION=$(echo -n $ARCHWAY_VERSION | tr a-z A-Z)
PARCEL_BASE="cloudera-integration/parcel"
CSD_BASE="cloudera-integration/csd"
BUILD_BASE="cloudera-integration/build"
PUBLISH_DIR=${BUILD_BASE}/publish
DEPLOY_REPO=parcels-dev
mkdir -p ${BUILD_BASE}
mkdir -p ${PUBLISH_DIR}
package()
{
ARTIFACT=$1
BUILD_NAME=$(echo "${ARTIFACT}-${ARCHWAY_VERSION}" | tr a-z A-Z)
READY_DIR=${BUILD_BASE}/${BUILD_NAME}
mkdir -p ${READY_DIR}
cp -R ${PARCEL_BASE}/${ARTIFACT}-meta ${READY_DIR}
cp -r ${READY_DIR}/${ARTIFACT}-meta ${READY_DIR}/meta
sed -i "s/0.1.5/${ARCHWAY_VERSION}/g" "${READY_DIR}/meta/parcel.json"
echo -n ${ARCHWAY_VERSION} > "${READY_DIR}/version.txt"
mkdir -p ${READY_DIR}/usr/lib/archway-server
mkdir -p ${READY_DIR}/usr/lib/archway-tests
mkdir -p ${READY_DIR}/usr/bin/
mkdir -p ${READY_DIR}/usr/lib/flyway
# API artifacts
cp api/target/scala-2.12/archway-server.jar ${READY_DIR}/usr/lib/archway-server/
cp integration-test/target/scala-2.12/archway-integration-tests.jar ${READY_DIR}/usr/lib/archway-tests/
cp integration-test/target/scala-2.12/archway-test-dependencies.jar ${READY_DIR}/usr/lib/archway-tests/
cp common/target/scala-2.12/archway-common-tests.jar ${READY_DIR}/usr/lib/archway-tests/
# UI artifacts
cp -r dist ${READY_DIR}/usr/lib/archway-ui
cp -R public/images ${READY_DIR}/usr/lib/archway-ui/
cp -R public/fonts ${READY_DIR}/usr/lib/archway-ui/
# Control script
cp bin/* ${READY_DIR}/usr/bin/
# flyway
cp -r flyway/* ${READY_DIR}/usr/lib/flyway
pushd ${BUILD_BASE}
tar cvf ${BUILD_NAME}-el6.parcel ${BUILD_NAME}
popd
cp ${BUILD_BASE}/${BUILD_NAME}-el6.parcel ${PUBLISH_DIR}
pushd ${PUBLISH_DIR}
ln -sf ${BUILD_NAME}-el6.parcel ${BUILD_NAME}-el7.parcel
ln -sf ${BUILD_NAME}-el6.parcel ${BUILD_NAME}-sles12.parcel
ln -sf ${BUILD_NAME}-el6.parcel ${BUILD_NAME}-xenial.parcel
sha1sum $BUILD_NAME-el6.parcel | cut -d' ' -f1 > ${BUILD_NAME}-el6.parcel.sha
sha1sum $BUILD_NAME-el7.parcel | cut -d' ' -f1 > ${BUILD_NAME}-el7.parcel.sha
sha1sum $BUILD_NAME-sles12.parcel | cut -d' ' -f1 > ${BUILD_NAME}-sles12.parcel.sha
sha1sum $BUILD_NAME-xenial.parcel | cut -d' ' -f1 > ${BUILD_NAME}-xenial.parcel.sha
popd
}
csd()
{
cp -R ${CSD_BASE} ${BUILD_BASE}
pushd ${BUILD_BASE}/csd
sed -i -e "s/0.1.0/${ARCHWAY_VERSION}/g" descriptor/service.sdl
jar cvf ARCHWAY-${ARCHWAY_VERSION}.jar `find . -mindepth 1 -not -path "./.git*"`
popd
cp ${BUILD_BASE}/csd/ARCHWAY-${ARCHWAY_VERSION}.jar ${PUBLISH_DIR}
}
manifest()
{
python build-support/bin/manifest.py ${PUBLISH_DIR}
}
ship()
{
pushd ${PUBLISH_DIR}
READY_DIR=$(echo "${ARCHWAY_VERSION}")
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T manifest.json https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/manifest.json
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ARCHWAY-${ARCHWAY_VERSION}.jar https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/ARCHWAY-${ARCHWAY_VERSION}.jar
push archway
popd
}
push()
{
ARTIFACT=$1
READY_DIR=$(echo "${ARTIFACT}-${ARCHWAY_VERSION}" | tr a-z A-Z)
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-el6.parcel https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-el6.parcel
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-el7.parcel https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-el7.parcel
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-sles12.parcel https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-sles12.parcel
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-xenial.parcel https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-xenial.parcel
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-el6.parcel.sha https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-el6.parcel.sha
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-el7.parcel.sha https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-el7.parcel.sha
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-sles12.parcel.sha https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-sles12.parcel.sha
curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN} -T ${READY_DIR}-xenial.parcel.sha https://repository.phdata.io/artifactory/$DEPLOY_REPO/phdata/archway/${ARCHWAY_VERSION}/${READY_DIR}-xenial.parcel.sha
}
case $1 in
parcel)
package $2
;;
csd)
csd
;;
manifest)
manifest
;;
ship)
ship
;;
esac