-
Notifications
You must be signed in to change notification settings - Fork 0
/
ads.set.up.svn.repo
executable file
·97 lines (67 loc) · 2.73 KB
/
ads.set.up.svn.repo
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
#!/bin/bash
repo_basename=nerd-golf-tracker
repo="$HOME/svn/$repo_basename"
initial_sources=/tmp/it-agile-nerd-golf-tracker.tar.gz
workspace="$HOME/integration_space/$repo_basename"
# Init repo
rm -rf "$repo"
mkdir -p "$repo"
svnadmin create "$repo"
echo "[general]" > "$repo/conf/svnserve.conf"
echo "anon-access = write" >> "$repo/conf/svnserve.conf"
# Setup dir for importing sources
rm -rf "$workspace"
mkdir -p "$workspace"
cd "$workspace"
# Import initial sources
wget --output-document="$initial_sources" --no-check-certificate https://github.com/it-agile/nerd-golf-tracker/tarball/master
tar -xzf "$initial_sources" --strip-components=1
svn import "$workspace" "file://$repo" -m "Initial commit"
# Setup empty integration space
rm -rf "$workspace"
mkdir -p "$workspace"
cd "$workspace"
cd ..
svn checkout "file://$repo"
# Import ignore settings
cd "$workspace"
svn propset svn:ignore -F .svnignore .
svn rm .svnignore
cd ".settings"
svn propset svn:ignore -F .svnignore .
svn rm .svnignore
cd "$workspace"
svn ci -m "Ignore build and IDE artifacts"
####################################################################
# Set this machine as repository
####################################################################
ipOf() {
LC_ALL=C ifconfig "$1" \
| grep inet\ addr \
| cut -f 2 -d : \
| cut -f 1 -d " "
}
local_ip=`ipOf eth0` # First try IP of eth0, if we serve as an internet bridge
if [ -z $local_ip ]; then local_ip=`ipOf wlan0`; fi # Next try IP of wlan
if [ -z $local_ip ]; then local_ip="<IP-Adresse>"; fi # Fallback: Insert dummy string
sed -i -e "s/localhost/$local_ip/" build.gradle gradle/wrapper/gradle-wrapper.properties
svn ci -m "Use integration machine as artifact repository"
####################################################################
# Nexus
####################################################################
nexus_storage="$HOME/local/sonatype-work/nexus/storage"
# Download Gradle unless already present
gradle_version=$(grep 'gradleVersion =' build.gradle | cut -d\' -f 2)
gradle_dist_group_path="$nexus_storage/releases/org/gradle/gradle/$gradle_version"
mkdir -p "$gradle_dist_group_path"
gradle_dist_artifact_path="$gradle_dist_group_path/gradle-$gradle_version-all.zip"
if [ ! -f $gradle_dist_artifact_path ]; then
wget --output-document="$gradle_dist_artifact_path" "https://services.gradle.org/distributions/gradle-$gradle_version-all.zip"
fi
# Remove Nexus artifacts
rm -f "$nexus_storage/snapshots/de/itagile/golf/nerd-golf-tracker/1.0-SNAPSHOT"/*
####################################################################
# misc
####################################################################
# Remove Jenkins jobs
rm -rf $HOME/.jenkins/jobs/*