Skip to content

Commit 2633bb5

Browse files
authored
Merge pull request #528 from jenkinsci/remove-ssh-publish/phase-1
chore(*/publish) preserve file timestamps on remote copies, get rid of remote SSH/rsync of binaries for `war`, `msi` and `deb`
2 parents 615e7ae + 91573a6 commit 2633bb5

File tree

5 files changed

+30
-107
lines changed

5 files changed

+30
-107
lines changed

deb/publish/publish.sh

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ set -euxo pipefail
1212
# $$ Contains current pid
1313
D="$AGENT_WORKDIR/$$"
1414

15-
# Convert string to array to correctly escape cli parameter
16-
SSH_OPTS=($SSH_OPTS)
17-
1815
bin="$(dirname "$0")"
1916

2017
function clean() {
@@ -69,13 +66,10 @@ function init() {
6966

7067
# where to put repository index and other web contents
7168
mkdir -p "$DEB_WEBDIR"
72-
## On remote serve
73-
# shellcheck disable=SC2029
74-
ssh "${SSH_OPTS[@]}" "$PKGSERVER" mkdir -p "$DEBDIR/"
7569
}
7670

7771
function skipIfAlreadyPublished() {
78-
if ssh "${SSH_OPTS[@]}" "$PKGSERVER" test -e "${DEBDIR}/$(basename "$DEB")"; then
72+
if test -e "${DEBDIR}/$(basename "$DEB")"; then
7973
echo "File already published, nothing else todo"
8074
return 0
8175
fi
@@ -88,18 +82,10 @@ function uploadPackage() {
8882
--verbose \
8983
--recursive \
9084
--compress \
85+
--times \
9186
--ignore-existing \
9287
--progress \
9388
"$DEB" "$DEBDIR/"
94-
95-
rsync \
96-
--archive \
97-
--verbose \
98-
--compress \
99-
--ignore-existing \
100-
--progress \
101-
-e "ssh ${SSH_OPTS[*]}" \
102-
"${DEB}" "$PKGSERVER:${DEBDIR// /\\ }"
10389
}
10490

10591
function uploadPackageSite() {
@@ -114,12 +100,14 @@ function uploadPackageSite() {
114100
--verbose \
115101
--recursive \
116102
--compress \
103+
--times \
117104
--progress \
118105
"$D/contents/" "$DEB_WEBDIR/"
119106

120107
rsync \
121108
--archive \
122109
--compress \
110+
--times \
123111
--progress \
124112
--verbose \
125113
-e "ssh ${SSH_OPTS[*]}" \
@@ -133,6 +121,7 @@ function uploadHtmlSite() {
133121
--include "FOOTER.html" \
134122
--exclude "*" \
135123
--compress \
124+
--times \
136125
--recursive \
137126
--progress \
138127
--verbose \
@@ -141,23 +130,13 @@ function uploadHtmlSite() {
141130
rsync \
142131
--archive \
143132
--compress \
133+
--times \
144134
--include "index.html" \
145135
--exclude "*" \
146136
--progress \
147137
--verbose \
148138
-e "ssh ${SSH_OPTS[*]}" \
149139
"$D/html/" "$PKGSERVER:${DEB_WEBDIR// /\\ }/"
150-
151-
rsync \
152-
--archive \
153-
--compress \
154-
--include "HEADER.html" \
155-
--include "FOOTER.html" \
156-
--exclude "*" \
157-
--progress \
158-
--verbose \
159-
-e "ssh ${SSH_OPTS[*]}" \
160-
"$D/html/" "$PKGSERVER:${DEBDIR// /\\ }/"
161140
}
162141

163142
function show() {

msi/publish/publish.sh

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ set -euxo pipefail
66
: "${MSI:?Require Jenkins War file}"
77
: "${MSIDIR:? Require where to put binary files}"
88

9-
# Convert string to array to correctly escape cli parameter
10-
SSH_OPTS=($SSH_OPTS)
11-
129
# $$ Contains current pid
1310
D="$AGENT_WORKDIR/$$"
1411

@@ -27,12 +24,10 @@ function init() {
2724
mkdir -p $D
2825

2926
mkdir -p "${MSIDIR}/${VERSION}/"
30-
31-
ssh "${SSH_OPTS[@]}" "$PKGSERVER" mkdir -p "$MSIDIR/${VERSION}/"
3227
}
3328

3429
function skipIfAlreadyPublished() {
35-
if ssh "${SSH_OPTS[@]}" "$PKGSERVER" test -e "${MSIDIR}/${VERSION}/$(basename "$MSI")"; then
30+
if test -e "${MSIDIR}/${VERSION}/$(basename "$MSI")"; then
3631
echo "File already published, nothing else todo"
3732
exit 0
3833

@@ -49,6 +44,7 @@ function uploadPackage() {
4944
# Local
5045
rsync \
5146
--compress \
47+
--times \
5248
--verbose \
5349
--recursive \
5450
--ignore-existing \
@@ -57,31 +53,13 @@ function uploadPackage() {
5753

5854
rsync \
5955
--compress \
56+
--times \
6057
--ignore-existing \
6158
--recursive \
6259
--progress \
6360
--verbose \
6461
"${MSI_SHASUM}" "${MSIDIR}/${VERSION}/"
6562

66-
# Remote
67-
rsync \
68-
--archive \
69-
--compress \
70-
--verbose \
71-
--ignore-existing \
72-
--progress \
73-
-e "ssh ${SSH_OPTS[*]}" \
74-
"${MSI}" "$PKGSERVER:${MSIDIR}/${VERSION}/"
75-
76-
rsync \
77-
--archive \
78-
--compress \
79-
--verbose \
80-
--ignore-existing \
81-
--progress \
82-
-e "ssh ${SSH_OPTS[*]}" \
83-
"${MSI_SHASUM}" "$PKGSERVER:${MSIDIR}/${VERSION}/"
84-
8563
# Update the symlink to point to most recent Windows build
8664
#
8765
# Remove anything in current directory named 'latest'
@@ -92,16 +70,15 @@ function uploadPackage() {
9270
# Don't need VERSION directory or MSI locally, just the unresolved symlink.
9371
# The jenkins.io page downloads http://mirrors.jenkins-ci.org/windows/latest
9472
# and assumes it points to the most recent MSI file.
95-
ln -s ${VERSION}/"$(basename "$MSI")" latest
73+
ln -s "${VERSION}/$(basename "$MSI")" latest
9674

97-
# Copy the symlink to PKGSERVER in the root of MSIDIR
9875
# Overwrites the existing symlink on the destination
9976
rsync \
77+
--times \
10078
--archive \
10179
--links \
10280
--verbose \
103-
-e "ssh ${SSH_OPTS[*]}" \
104-
latest "$PKGSERVER:${MSIDIR}/"
81+
latest "${MSIDIR}/"
10582

10683
# Remove the local symlink
10784
rm latest
@@ -111,27 +88,17 @@ function uploadPackage() {
11188
function uploadSite() {
11289
rsync \
11390
--compress \
91+
--times \
11492
--verbose \
11593
--recursive \
11694
--progress \
117-
-e "ssh ${SSH_OPTS[*]}" \
11895
"${D}/" "${MSIDIR// /\\ }/"
119-
120-
rsync \
121-
--archive \
122-
--compress \
123-
--verbose \
124-
--progress \
125-
-e "ssh ${SSH_OPTS[*]}" \
126-
"${D}/" "$PKGSERVER:${MSIDIR// /\\ }/"
12796
}
12897

12998
function show() {
13099
echo "Parameters:"
131100
echo "MSI: $MSI"
132101
echo "MSIDIR: $MSIDIR"
133-
echo "SSH_OPTS: ${SSH_OPTS[*]}"
134-
echo "PKGSERVER: $PKGSERVER"
135102
echo "---"
136103
}
137104

rpm/publish/publish.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function uploadPackage() {
6969
# Local
7070
rsync \
7171
--verbose \
72+
--times \
7273
--compress \
7374
--ignore-existing \
7475
--recursive \
@@ -78,6 +79,7 @@ function uploadPackage() {
7879
# Remote
7980
rsync \
8081
--archive \
82+
--times \
8183
--verbose \
8284
--compress \
8385
-e "ssh ${SSH_OPTS[*]}" \
@@ -102,6 +104,7 @@ function uploadSite() {
102104
# Disable copy on local network storage
103105
#rsync \
104106
# --compress \
107+
# --times \
105108
# --recursive \
106109
# --verbose \
107110
# --exclude RPMS \
@@ -112,6 +115,7 @@ function uploadSite() {
112115

113116
rsync \
114117
--archive \
118+
--times \
115119
--compress \
116120
--verbose \
117121
-e "ssh ${SSH_OPTS[*]}" \
@@ -124,6 +128,7 @@ function uploadSite() {
124128
# Following html need to be located inside the binary directory
125129
rsync \
126130
--compress \
131+
--times \
127132
--verbose \
128133
--recursive \
129134
--include "HEADER.html" \
@@ -134,6 +139,7 @@ function uploadSite() {
134139

135140
rsync \
136141
--archive \
142+
--times \
137143
--compress \
138144
--verbose \
139145
-e "ssh ${SSH_OPTS[*]}" \

suse/publish/publish.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function show() {
6666
function uploadPackage() {
6767
rsync \
6868
--recursive \
69+
--times \
6970
--verbose \
7071
--compress \
7172
--ignore-existing \
@@ -74,6 +75,7 @@ function uploadPackage() {
7475

7576
rsync \
7677
--archive \
78+
--times \
7779
--verbose \
7880
--compress \
7981
--ignore-existing \
@@ -86,6 +88,7 @@ function uploadSite() {
8688
pushd $D
8789
rsync \
8890
--recursive \
91+
--times \
8992
--verbose \
9093
--compress \
9194
--progress \
@@ -97,6 +100,7 @@ function uploadSite() {
97100
# shellcheck disable=SC2029
98101
rsync \
99102
--archive \
103+
--times \
100104
--verbose \
101105
--compress \
102106
--progress \
@@ -140,6 +144,7 @@ function uploadSite() {
140144
# Following html need to be located inside the binary directory
141145
rsync \
142146
--compress \
147+
--times \
143148
--verbose \
144149
--recursive \
145150
--include "HEADER.html" \
@@ -150,6 +155,7 @@ function uploadSite() {
150155

151156
rsync \
152157
--archive \
158+
--times \
153159
--compress \
154160
--verbose \
155161
-e "ssh ${SSH_OPTS[*]}" \

0 commit comments

Comments
 (0)