forked from redhat-developer/developers.redhat.com
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pr-build-steps.sh
43 lines (35 loc) · 1.62 KB
/
pr-build-steps.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
#!/bin/bash --login -e
set -e
# Needed so we can pull data-container-lite
docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
# Needed for rsync
cp /home/jenkins_developer/id_rsa $WORKSPACE/_docker/awestruct/overlay/ssh-key/
cp /home/jenkins_developer/known_hosts $WORKSPACE/_docker/awestruct/overlay/ssh-key/
bundle
cd _docker/
bundle install
ruby ./control.rb -e drupal-pull-request --run-the-stack --no-decrypt
drupal_port=$((35000 + $ghprbPullId))
drupal_url="http://rhdp-jenkins-slave.lab4.eng.bos.redhat.com:${drupal_port}"
drupal_status=$(curl -XHEAD ${drupal_url})
# Update GitHub with the new Drupal Link
if [ $drupal_status -ne 0 ]
then
curl -XPOST -H "Authorization: token ${github_status_api_token}" https://api.github.com/repos/redhat-developer/developers.redhat.com/statuses/${ghprbActualCommit} -d "{
\"state\": \"failure\",
\"context\": \"drupal-site\",
\"target_url\": \"${drupal_url}\",
\"description\": \"$(docker logs rhdpr${ghprbPullId}_drupal_1 | tail -n 3)\"
}"
exit 1 # exit, no point continuing
else
curl -XPOST -H "Authorization: token ${github_status_api_token}" https://api.github.com/repos/redhat-developer/developers.redhat.com/statuses/${ghprbActualCommit} -d "{
\"state\": \"success\",
\"context\": \"drupal-site\",
\"target_url\": \"${drupal_url}\",
\"description\": \"finished ok!\"
}"
fi
# Start the export process
docker exec rhdpr${ghprbPullId}_drupal_1 bash -c "source /etc/scl_enable && drush cron"
ruby ./control.rb -e drupal-pull-request --export rhd@filemgmt.jboss.org:/stg_htdocs/it-rhd-stg[/pr/${ghprbPullId}/export] --no-decrypt --no-kill