Add signing to Akraino deploy templates
[ci-management.git] / jjb / shell / get-upstream-autostage.sh
1 #!/bin/bash
2 #
3 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Copied (and modified slightly) from edgexfoundry
18 # Do not fail this job as this is a stopgap for now.
19 set +e
20
21 # Look in our console log for the triggering build number
22 T=/tmp/ups.$$
23 curl $BUILD_URL/consoleText | grep "Started by upstream project" > $T
24 if [ -s $T ]
25 then
26     # $T should contain "06:25:53 Started by upstream project "projname" build number 111"
27     upstream_name=$(   awk -F '"' '{print $2}' < $T)
28     upstream_number=$( awk -F '"' '{print $3}' < $T | awk -F ' ' '{print$3}')
29
30     # This is the URL of the console log for the triggering job
31     upstream_url="https://jenkins.akraino.org/job/$upstream_name/$upstream_number/consoleText"
32
33     # This identifies the staging directory for the staging URL
34     # https://nexus.akraino.org/content/repositories/autostaging-${AUTOSTAGING}/org/akraino/${PROJECT}/${VERSION}/${PROJECT}-${VERSION}.[jw]ar
35     #    or
36     # https://nexus.akraino.org/content/repositories/autostaging-${AUTOSTAGING}/${PROJECT}-${VERSION}.tgz
37     #    e.g.
38     # https://nexus.akraino.org/content/repositories/autostaging-1100/org/akraino/portal_user_interface/0.0.2/portal_user_interface-0.0.2.war
39     # https://nexus.akraino.org/content/repositories/autostaging-1099/org/akraino/camunda_workflow/0.0.2/camunda_workflow-0.0.2.jar
40     # https://nexus.akraino.org/content/repositories/autostaging-1091/airshipinabottle_deploy-0.0.1.tgz
41     AUTOSTAGING=$(curl $upstream_url | grep "Completed uploading files to autostaging" | sed 's/.*-//' | tr -d '.')
42 fi