Skip to content

Commit f79c40f

Browse files
authored
Merge pull request #540 from jenkinsci/helpdesk-4774
feat(publish/all) stop using remote server for packaging
2 parents 9f43bf9 + 29cfeaf commit f79c40f

File tree

7 files changed

+62
-290
lines changed

7 files changed

+62
-290
lines changed

deb/publish/publish.sh

Lines changed: 10 additions & 62 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() {
@@ -62,31 +59,15 @@ function generateSite() {
6259
}
6360

6461
function init() {
65-
mkdir -p "$D/binary" "$D/contents" "$D/html"
66-
67-
# where to put binary files
68-
mkdir -p "$DEBDIR" # where to put binary files
69-
70-
# where to put repository index and other web contents
71-
mkdir -p "$DEB_WEBDIR"
72-
}
73-
74-
function skipIfAlreadyPublished() {
75-
if [[ -f "${DEBDIR}/$(basename "$DEB")" ]]; then
76-
echo "File already published, nothing else todo"
77-
return 0
78-
fi
79-
return 1
62+
mkdir -p "$D/binary" "$D/contents" "$D/html" \
63+
"$DEBDIR" `# where to put binary files` \
64+
"$DEB_WEBDIR" `# where to put repository index and other web contents`
8065
}
8166

8267
# Upload Debian Package
8368
function uploadPackage() {
84-
rsync \
69+
rsync --archive \
8570
--verbose \
86-
--recursive \
87-
--compress \
88-
--times \
89-
--ignore-existing \
9071
--progress \
9172
"$DEB" "$DEBDIR/"
9273
}
@@ -99,56 +80,28 @@ function uploadPackageSite() {
9980
"$D"/binary/Contents* \
10081
"$D"/contents/binary
10182

102-
rsync \
83+
rsync --archive \
10384
--verbose \
104-
--recursive \
105-
--compress \
106-
--times \
10785
--progress \
10886
"$D/contents/" "$DEB_WEBDIR/"
109-
110-
rsync \
111-
--archive \
112-
--compress \
113-
--times \
114-
--progress \
115-
--verbose \
116-
-e "ssh ${SSH_OPTS[*]}" \
117-
"$D/contents/" "$PKGSERVER:${DEB_WEBDIR// /\\ }/"
11887
}
11988

12089
function uploadHtmlSite() {
12190
# Html file need to be located in the binary directory
122-
rsync \
91+
rsync --archive \
92+
--verbose \
93+
--progress \
12394
--include "HEADER.html" \
12495
--include "FOOTER.html" \
12596
--exclude "*" \
126-
--compress \
127-
--times \
128-
--recursive \
129-
--progress \
130-
--verbose \
13197
"$D/html/" "$DEBDIR/"
132-
133-
rsync \
134-
--archive \
135-
--compress \
136-
--times \
137-
--include "index.html" \
138-
--exclude "*" \
139-
--progress \
140-
--verbose \
141-
-e "ssh ${SSH_OPTS[*]}" \
142-
"$D/html/" "$PKGSERVER:${DEB_WEBDIR// /\\ }/"
14398
}
14499

145100
function show() {
146101
echo "Parameters:"
147102
echo "DEB: $DEB"
148103
echo "DEBDIR: $DEBDIR"
149104
echo "DEB_WEBDIR: $DEB_WEBDIR"
150-
echo "SSH_OPTS: ${SSH_OPTS[*]}"
151-
echo "PKGSERVER: $PKGSERVER"
152105
echo "GPG_KEYNAME: $GPG_KEYNAME"
153106
echo "---"
154107
}
@@ -171,17 +124,12 @@ function signSite() {
171124
}
172125

173126
show
174-
## Disabling this function allow us to recreate and sign the repository.
175-
# the debian package won't be overrided as we use the parameter '--ignore-existing'
176-
#skipIfAlreadyPublished
177127
init
178128
generateSite
179129
signSite
180130

181-
if ! skipIfAlreadyPublished; then
182-
uploadPackage
183-
uploadPackageSite
184-
fi
131+
uploadPackage
132+
uploadPackageSite
185133

186134
uploadHtmlSite
187135
clean

env/azure.mk

Lines changed: 0 additions & 25 deletions
This file was deleted.

env/release.mk

Lines changed: 0 additions & 27 deletions
This file was deleted.

env/test.mk

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
#
22
# Environment definition for dry-run of the packaging process
3-
#
4-
5-
# JENKINS used to generate MSI packages
6-
export JENKINS_URL=https://cloudbees.ci.cloudbees.com/
7-
8-
# the host to publish bits to
9-
export PKGSERVER=jenkins@remote
10-
# Testing both with and without SSH_OPTS
11-
#export SSH_OPTS=-p 22
12-
#export SCP_OPTS=-P 22
13-
export SSH_OPTS=-p 22
14-
export SCP_OPTS=-P 22
3+
#
154

165
# where to put binary files
176
export TESTDIR=$(realpath .)/pkg.jenkins.io
@@ -23,10 +12,9 @@ export RPMDIR=${TESTDIR}/rpm${RELEASELINE}
2312
# where to put repository index and other web contents
2413
export RPM_WEBDIR=${TESTDIR}/rpm${RELEASELINE}
2514
export DEB_WEBDIR=${TESTDIR}/debian${RELEASELINE}
26-
export WAR_WEBDIR=${TESTDIR}/war${RELEASELINE}
2715
export MSI_WEBDIR=${TESTDIR}/windows${RELEASELINE}
2816

2917
# URL to the aforementioned webdir.
30-
WEBSERVER=pkg.jenkins.io
31-
export RPM_URL=https://${WEBSERVER}/rpm${RELEASELINE}
32-
export DEB_URL=https://${WEBSERVER}/debian${RELEASELINE}
18+
WEBSERVER=https://pkg.jenkins.io
19+
export RPM_URL=${WEBSERVER}/rpm${RELEASELINE}
20+
export DEB_URL=${WEBSERVER}/debian${RELEASELINE}

msi/publish/publish.sh

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,15 @@ function generateSite() {
2121
}
2222

2323
function init() {
24-
mkdir -p "$D"
25-
26-
mkdir -p "${MSIDIR}/${VERSION}/"
27-
}
28-
29-
function skipIfAlreadyPublished() {
30-
if [[ -f "${MSIDIR}/${VERSION}/$(basename "$MSI")" ]]; then
31-
echo "File already published, nothing else todo"
32-
exit 0
33-
34-
fi
24+
mkdir -p "$D" "${MSIDIR}/${VERSION}"
3525
}
3626

3727
function uploadPackage() {
3828
cp "${ARTIFACTNAME}-${VERSION}${RELEASELINE}.msi" "${MSI}"
3929

4030
sha256sum "${MSI}" >"${MSI_SHASUM}"
41-
4231
cat "${MSI_SHASUM}"
4332

44-
# Local
45-
rsync \
46-
--compress \
47-
--times \
48-
--verbose \
49-
--recursive \
50-
--ignore-existing \
51-
--progress \
52-
"${MSI}" "${MSIDIR}/${VERSION}/"
53-
54-
rsync \
55-
--compress \
56-
--times \
57-
--ignore-existing \
58-
--recursive \
59-
--progress \
60-
--verbose \
61-
"${MSI_SHASUM}" "${MSIDIR}/${VERSION}/"
62-
6333
# Update the symlink to point to most recent Windows build
6434
#
6535
# Remove anything in current directory named 'latest'
@@ -72,25 +42,17 @@ function uploadPackage() {
7242
# and assumes it points to the most recent MSI file.
7343
ln -s "${VERSION}/$(basename "$MSI")" latest
7444

75-
# Overwrites the existing symlink on the destination
76-
rsync \
77-
--times \
78-
--archive \
79-
--links \
45+
# Local
46+
rsync --archive \
8047
--verbose \
81-
latest "${MSIDIR}/"
82-
83-
# Remove the local symlink
84-
rm latest
48+
--progress \
49+
"${MSI}" "${MSI_SHASUM}" latest "${MSIDIR}/${VERSION}/"
8550
}
8651

8752
# The site need to be located in the binary directory
8853
function uploadSite() {
89-
rsync \
90-
--compress \
91-
--times \
54+
rsync --archive \
9255
--verbose \
93-
--recursive \
9456
--progress \
9557
"${D}/" "${MSIDIR// /\\ }/"
9658
}
@@ -103,7 +65,6 @@ function show() {
10365
}
10466

10567
show
106-
skipIfAlreadyPublished
10768
init
10869
generateSite
10970
uploadPackage

0 commit comments

Comments
 (0)