Skip to content

Commit cd7d47d

Browse files
committed
- re-add lost %dir %{_datadir}/%{name}
- merge openSUSE and Red Hat build scripts as well as their spec files and only build a single rpm - merge openSUSE and Red Hat publish scripts for a common rpm repository and a common web page - always gpg sign repomd.xml and set repo_gpgcheck for the common repo file - set releasever from 1.1 to 1 - (gitignore test-webroot)
1 parent a1bd916 commit cd7d47d

25 files changed

+103
-784
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ generated
1212

1313
msi/build
1414
venv/
15-
15+
pkg.jenkins.io/

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ podTemplate(yaml: readTrusted('KubernetesPod.yaml'), workingDir: '/home/jenkins/
3131
stage('Build') {
3232
sh 'make package && python3 -m pytest bin --junitxml target/junit.xml'
3333
junit 'target/junit.xml'
34-
def results = '*.war, target/debian/*.deb, target/rpm/*.rpm, target/suse/*.rpm'
34+
def results = '*.war, target/debian/*.deb, target/rpm/*.rpm'
3535
stash includes: results, name: 'results'
3636
archiveArtifacts results
3737
}

Makefile

+3-9
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ clean:
2323
setup:
2424
bash -ex -c 'for f in */setup.sh; do $$f; done'
2525

26-
package: war deb rpm suse
26+
package: war deb rpm
2727

28-
publish: war.publish deb.publish rpm.publish suse.publish
28+
publish: war.publish deb.publish rpm.publish
2929

30-
test: deb.test rpm.test suse.test
30+
test: deb.test rpm.test
3131

3232
war: ${WAR}
3333
war.publish: ${WAR}
@@ -49,12 +49,6 @@ ${RPM}: ${WAR} $(shell find rpm/build -type f)
4949
rpm.publish: ${RPM} $(shell find rpm/publish -type f)
5050
./rpm/publish/publish.sh
5151

52-
suse: ${SUSE}
53-
${SUSE}: ${WAR} $(shell find suse/build -type f)
54-
./suse/build/build.sh
55-
suse.publish: ${SUSE} $(shell find suse/publish -type f)
56-
./suse/publish/publish.sh
57-
5852
msi.publish:
5953
./msi/publish/publish.sh
6054

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ This repository contains scripts for packaging `jenkins.war` into various platfo
44
The following platforms are currently supported:
55

66
* Windows MSI: `msi/`
7-
* RedHat/CentOS RPM: `rpm/`
7+
* RedHat/CentOS/openSUSE RPM: `rpm/`
88
* Debian/Ubuntu DEB: `deb/`
9-
* OpenSUSE RPM: `suse/`
109

1110
# Pre-requisites
1211
Running the main package script requires a Linux environment (currently Ubuntu, see [JENKINS-27744](https://issues.jenkins-ci.org/browse/JENKINS-27744).)

bin/branding.list

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ORGANIZATION
1313
----------------------------------
1414
RELEASELINE
1515
RPM_URL
16-
SUSE_URL
1716
DEB_URL
1817
LICENSE_TEXT
1918
LICENSE_TEXT_DEB

bin/indexGenerator.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@ class IndexGenerator:
1818
"template": "header.debian.html",
1919
"web_url": os.getenv("DEB_URL"),
2020
},
21-
"redhat": {
21+
"rpm": {
2222
"extension": ".rpm",
23-
"template": "header.redhat.html",
23+
"template": "header.rpm.html",
2424
"web_url": os.getenv("RPM_URL"),
2525
},
26-
"opensuse": {
27-
"extension": ".rpm",
28-
"template": "header.opensuse.html",
29-
"web_url": os.getenv("SUSE_URL"),
30-
},
3126
"war": {"extension": ".war", "template": "header.war.html", "web_url": "unset"},
3227
"windows": {
3328
"extension": ".msi",
@@ -38,7 +33,7 @@ class IndexGenerator:
3833

3934
HELP_MESSAGE = """
4035
Generate header.html for package distribution site
41-
It supports debian, redhat and opensuse packages
36+
It supports debian and rpm packages
4237
4338
indexGenerator.py
4439
-d <distribution>: Which package distribution to target

bin/test_branding.py

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
CHANGELOG_PAGE
2121
----------------------------------
2222
23-
SUSE_URL
2423
# INVALID
2524
DEB_URL
2625
LICENSE_TEXT
@@ -56,7 +55,6 @@ def test_clean_lines(self):
5655
"LICENSE",
5756
"HOMEPAGE",
5857
"CHANGELOG_PAGE",
59-
"SUSE_URL",
6058
"DEB_URL",
6159
"LICENSE_TEXT",
6260
}

env/azure.mk

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@ export SCP_OPTS=-P 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nul
1111
export WARDIR=/srv/releases/jenkins/war${RELEASELINE}
1212
export MSIDIR=/srv/releases/jenkins/windows${RELEASELINE}
1313
export DEBDIR=/srv/releases/jenkins/debian${RELEASELINE}/binary
14-
export RPMDIR=/srv/releases/jenkins/redhat${RELEASELINE}
15-
export SUSEDIR=/srv/releases/jenkins/opensuse${RELEASELINE}
14+
export RPMDIR=/srv/releases/jenkins/rpm${RELEASELINE}
1615

1716
# where to put repository index and other web contents
18-
export RPM_WEBDIR=/srv/releases/jenkins/redhat${RELEASELINE}
17+
export RPM_WEBDIR=/srv/releases/jenkins/rpm${RELEASELINE}
1918
export MSI_WEBDIR=/srv/releases/jenkins/windows${RELEASELINE}
20-
export SUSE_WEBDIR=/srv/releases/jenkins/opensuse${RELEASELINE}
2119
export DEB_WEBDIR=/srv/releases/jenkins/debian${RELEASELINE}
2220
export WAR_WEBDIR=/srv/releases/jenkins/war${RELEASELINE}
2321

2422
# URL to the aforementioned webdir.
2523
WEBSERVER=pkg.jenkins.io
26-
export RPM_URL=https://${WEBSERVER}/redhat${RELEASELINE}
27-
export SUSE_URL=https://${WEBSERVER}/opensuse${RELEASELINE}
24+
export RPM_URL=https://${WEBSERVER}/rpm${RELEASELINE}
2825
export DEB_URL=https://${WEBSERVER}/debian${RELEASELINE}

env/release.mk

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ export SCP_OPTS=-P 22
1414
export WARDIR=/srv/releases/jenkins/war${RELEASELINE}
1515
export MSIDIR=/srv/releases/jenkins/windows${RELEASELINE}
1616
export DEBDIR=/srv/releases/jenkins/debian${RELEASELINE}
17-
export RPMDIR=/srv/releases/jenkins/redhat${RELEASELINE}
18-
export SUSEDIR=/srv/releases/jenkins/opensuse${RELEASELINE}
17+
export RPMDIR=/srv/releases/jenkins/rpm${RELEASELINE}
1918

2019
# where to put repository index and other web contents
21-
export RPM_WEBDIR=/var/www/pkg.jenkins.io.staging/redhat${RELEASELINE}
22-
export SUSE_WEBDIR=/var/www/pkg.jenkins.io.staging/opensuse${RELEASELINE}
20+
export RPM_WEBDIR=/var/www/pkg.jenkins.io.staging/rpm${RELEASELINE}
2321
export DEB_WEBDIR=/var/www/pkg.jenkins.io.staging/debian${RELEASELINE}
2422
export WAR_WEBDIR=/var/www/pkg.jenkins.io.staging/war${RELEASELINE}
2523
export MSI_WEBDIR=/var/www/pkg.jenkins.io.staging/windows${RELEASELINE}
2624

2725
# URL to the aforementioned webdir
28-
export RPM_URL=https://pkg.jenkins.io/redhat${RELEASELINE}
29-
export SUSE_URL=https://pkg.jenkins.io/opensuse${RELEASELINE}
26+
export RPM_URL=https://pkg.jenkins.io/rpm${RELEASELINE}
3027
export DEB_URL=https://pkg.jenkins.io/debian${RELEASELINE}

env/test.mk

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,15 @@ export TESTDIR=$(realpath .)/pkg.jenkins.io
1818
export WARDIR=${TESTDIR}/war${RELEASELINE}
1919
export MSIDIR=${TESTDIR}/windows${RELEASELINE}
2020
export DEBDIR=${TESTDIR}/debian${RELEASELINE}/binary
21-
export RPMDIR=${TESTDIR}/redhat${RELEASELINE}
22-
export SUSEDIR=${TESTDIR}/opensuse${RELEASELINE}
21+
export RPMDIR=${TESTDIR}/rpm${RELEASELINE}
2322

2423
# where to put repository index and other web contents
25-
export RPM_WEBDIR=${TESTDIR}/redhat${RELEASELINE}
26-
export SUSE_WEBDIR=${TESTDIR}/opensuse${RELEASELINE}
24+
export RPM_WEBDIR=${TESTDIR}/rpm${RELEASELINE}
2725
export DEB_WEBDIR=${TESTDIR}/debian${RELEASELINE}
2826
export WAR_WEBDIR=${TESTDIR}/war${RELEASELINE}
2927
export MSI_WEBDIR=${TESTDIR}/windows${RELEASELINE}
3028

3129
# URL to the aforementioned webdir.
3230
WEBSERVER=pkg.jenkins.io
33-
export RPM_URL=https://${WEBSERVER}/redhat${RELEASELINE}
34-
export SUSE_URL=https://${WEBSERVER}/opensuse${RELEASELINE}
31+
export RPM_URL=https://${WEBSERVER}/rpm${RELEASELINE}
3532
export DEB_URL=https://${WEBSERVER}/debian${RELEASELINE}

molecule/default/install-suse.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
state: present
1717
key: /var/tmp/target/credentials/test.ascii.key
1818
- find:
19-
paths: /var/tmp/target/suse
19+
paths: /var/tmp/target/rpm
2020
file_type: file
2121
patterns: "*.rpm"
2222
register: package_list

rpm/build/SOURCES/jenkins.repo

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[@@ARTIFACTNAME@@]
22
name=@@PRODUCTNAME@@
33
baseurl=@@RPM_URL@@
4+
# TODO 'jenkins.io' {{ web_url }}/{{organization}}-2023.key
5+
gpgkey=@@RPM_URL@@/jenkins.io-2023.key
46
gpgcheck=1

rpm/build/SPECS/jenkins.spec

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
Name: @@ARTIFACTNAME@@
77
Version: %{ver}
8-
Release: 1.1
8+
Release: 1
99
Summary: @@SUMMARY@@
1010
Source: jenkins.war
1111
Source1: jenkins.service
@@ -73,6 +73,7 @@ fi
7373
%ghost %{_localstatedir}/cache/%{name}
7474
%{_unitdir}/%{name}.service
7575
%{_bindir}/%{name}
76+
%dir %{_datadir}/%{name}
7677
%{_datadir}/%{name}/migrate
7778

7879
%changelog

rpm/publish/publish.sh

+21-25
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euxo pipefail
77
: "${RPM_WEBDIR:?Require where to put index and other web contents}"
88
: "${RPM_URL:?Require rpm repository url}"
99
: "${RELEASELINE?Require rpm release line}"
10-
: "${BASE:? Required base directory}"
10+
: "${BASE:?Require base directory}"
1111

1212
# $$ Contains current pid
1313
D="$AGENT_WORKDIR/$$"
@@ -21,10 +21,10 @@ function clean() {
2121

2222
function generateSite() {
2323
gpg --export -a --output "$D/${ORGANIZATION}.key" "${GPG_KEYNAME}"
24-
echo "$(gpg --import-options show-only --import $D/${ORGANIZATION}.key)" >"$D/${ORGANIZATION}.key.info"
24+
gpg --import-options show-only --import "$D/${ORGANIZATION}.key" >"$D/${ORGANIZATION}.key.info"
2525

2626
"$BASE/bin/indexGenerator.py" \
27-
--distribution redhat \
27+
--distribution rpm \
2828
--gpg-key-info-file "${D}/${ORGANIZATION}.key.info" \
2929
--targetDir "$D"
3030

@@ -36,16 +36,10 @@ function generateSite() {
3636
[${ARTIFACTNAME}]
3737
name=${PRODUCTNAME}${RELEASELINE}
3838
baseurl=${RPM_URL}
39+
gpgkey=${RPM_URL}/${ORGANIZATION}-2023.key
3940
gpgcheck=1
41+
repo_gpgcheck=1
4042
EOF
41-
42-
# generate index
43-
# locally
44-
# disable this for now, as it's currently now used and generate errors
45-
# createrepo --update -o "$RPM_WEBDIR" "$RPMDIR/"
46-
# on the server
47-
# shellcheck disable=SC2029
48-
ssh "${SSH_OPTS[@]}" "$PKGSERVER" createrepo --update -o "'$RPM_WEBDIR'" "'$RPMDIR/'"
4943
}
5044

5145
function skipIfAlreadyPublished() {
@@ -60,7 +54,6 @@ function init() {
6054
mkdir -p "$D/RPMS/noarch"
6155

6256
mkdir -p "$RPMDIR/"
63-
# mkdir -p "$RPM_WEBDIR/" # May not be necessary
6457
# shellcheck disable=SC2029
6558
ssh "${SSH_OPTS[@]}" "$PKGSERVER" mkdir -p "'$RPMDIR/'"
6659
}
@@ -83,7 +76,7 @@ function uploadPackage() {
8376
-e "ssh ${SSH_OPTS[*]}" \
8477
--ignore-existing \
8578
--progress \
86-
"$RPM" "$PKGSERVER:${RPMDIR// /\\ }/"
79+
"${RPM}" "$PKGSERVER:${RPMDIR// /\\ }/"
8780
}
8881

8982
function show() {
@@ -99,17 +92,6 @@ function show() {
9992

10093
function uploadSite() {
10194
pushd "$D"
102-
# Disable copy on local network storage
103-
#rsync \
104-
# --compress \
105-
# --recursive \
106-
# --verbose \
107-
# --exclude RPMS \
108-
# --exclude "HEADER.html" \
109-
# --exclude "FOOTER.html" \
110-
# --progress \
111-
# . "$RPM_WEBDIR/"
112-
11395
rsync \
11496
--archive \
11597
--compress \
@@ -121,6 +103,20 @@ function uploadSite() {
121103
--progress \
122104
. "$PKGSERVER:${RPM_WEBDIR// /\\ }/"
123105

106+
# generate index on the server
107+
ssh "${SSH_OPTS[@]}" "$PKGSERVER" createrepo --update -o "'$RPM_WEBDIR'" "'$RPMDIR/'"
108+
109+
ssh "${SSH_OPTS[@]}" "$PKGSERVER" "cat $RPMDIR/repodata/repomd.xml" | \
110+
gpg \
111+
--batch \
112+
--pinentry-mode loopback \
113+
-u "$GPG_KEYNAME" \
114+
-a \
115+
--detach-sign \
116+
--passphrase-file "$GPG_PASSPHRASE_FILE" \
117+
--yes | \
118+
ssh "${SSH_OPTS[@]}" "$PKGSERVER" "cat > $RPMDIR/repodata/repomd.xml.asc"
119+
124120
# Following html need to be located inside the binary directory
125121
rsync \
126122
--compress \
@@ -146,7 +142,7 @@ function uploadSite() {
146142
}
147143

148144
show
149-
## Disabling this function allow us to recreate and sign the RedHat repository.
145+
## Disabling this function allow us to recreate and sign the rpm repository.
150146
# the rpm package won't be overrided as we use the parameter '--ignore-existing' when we upload it
151147
#skipIfAlreadyPublished
152148
init

setup.mk

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ export MSI_SHASUM:=${MSI}.sha256
1919
export DEB=${TARGET}/debian/${ARTIFACTNAME}_${VERSION}_all.deb
2020

2121
# where to generate RHEL/CentOS RPM file?
22-
export RPM=${TARGET}/rpm/${ARTIFACTNAME}-${VERSION}-1.1.noarch.rpm
23-
24-
# where to generate SUSE RPM file?
25-
export SUSE=${TARGET}/suse/${ARTIFACTNAME}-${VERSION}-1.2.noarch.rpm
22+
export RPM=${TARGET}/rpm/${ARTIFACTNAME}-${VERSION}-1.noarch.rpm
2623

2724
# anchored to the root of the repository
2825
export BASE:=$(CURDIR)

0 commit comments

Comments
 (0)