Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add packaging support for unix domain sockets #442

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deb/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cp -R "${dir}"/* "${D}"
cp "${BASE}/systemd/jenkins.service" "${D}/debian"
cp "${BASE}/systemd/jenkins.sh" "${D}"
cp "${BASE}/systemd/migrate.sh" "${D}"
cp "${BASE}/systemd/jenkins.conf" "${D}/debian/jenkins.tmpfiles"

# Create a description temp file
sed -i.bak -e 's/^\s*$/./' -e 's/^/ /' "${DESCRIPTION_FILE}"
Expand Down
5 changes: 5 additions & 0 deletions rpm/build/SPECS/jenkins.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Source: jenkins.war
Source1: jenkins.service
Source2: jenkins.sh
Source3: migrate.sh
Source4: jenkins.conf
URL: @@HOMEPAGE@@
License: @@LICENSE@@
BuildRoot: %{_tmppath}/build-%{name}-%{version}
Expand Down Expand Up @@ -42,6 +43,7 @@ rm -rf "%{buildroot}"
%__install -D -m0644 "%{SOURCE1}" "%{buildroot}%{_unitdir}/%{name}.service"
%__install -D -m0755 "%{SOURCE2}" "%{buildroot}%{_bindir}/%{name}"
%__install -D -m0755 "%{SOURCE3}" "%{buildroot}%{_datadir}/%{name}/migrate"
%__install -D -m0755 "%{SOURCE4}" "%{buildroot}%{_tmpfilesdir}/%{name}.conf"

%pre
/usr/bin/getent group %{name} &>/dev/null || /usr/sbin/groupadd -r %{name} &>/dev/null
Expand Down Expand Up @@ -74,8 +76,11 @@ fi
%{_unitdir}/%{name}.service
%{_bindir}/%{name}
%{_datadir}/%{name}/migrate
%{_tmpfilesdir}/%{name}.conf

%changelog
* Mon Nov 06 2023 [email protected]
- added unix domain socket support
* Mon Jun 19 2023 [email protected]
- removed sysv initscript for el>=7
- removed logrotate config
Expand Down
1 change: 1 addition & 0 deletions rpm/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cp -R "$(dirname "$0")"/* "${D}"
cp "${BASE}/systemd/jenkins.service" "${D}/SOURCES"
cp "${BASE}/systemd/jenkins.sh" "${D}/SOURCES"
cp "${BASE}/systemd/migrate.sh" "${D}/SOURCES"
cp "${BASE}/systemd/jenkins.conf" "${D}/SOURCES"
"${BASE}/bin/branding.py" "${D}"

cp "${WAR}" "${D}/SOURCES/jenkins.war"
Expand Down
1 change: 1 addition & 0 deletions systemd/jenkins.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
D /run/jenkins 0770 jenkins jenkins -

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuntimeDirectory="jenkins"

in jenkins.service should be a better fit here than a tmpfile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in jenkins.service should be a better fit here than a tmpfile.

It is usually much more effective to submit a pull request with an explanation why a different location would be better. If you're not ready to submit a pull request, then an issue report is another way to start the conversation.

Commenting on a merged pull request is not nearly as likely to result in any action.

3 changes: 3 additions & 0 deletions systemd/jenkins.service
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Environment="JENKINS_WEBROOT=%C/@@ARTIFACTNAME@@/war"
# Arguments for the Jenkins JVM
Environment="JAVA_OPTS=-Djava.awt.headless=true"

# Unix Domain Socket to listen on for local HTTP requests. Default is disabled.
#Environment="JENKINS_UNIX_DOMAIN_PATH=/run/jenkins/jenkins.socket"

# IP address to listen on for HTTP requests.
# The default is to listen on all interfaces (0.0.0.0).
#Environment="JENKINS_LISTEN_ADDRESS="
Expand Down
6 changes: 6 additions & 0 deletions systemd/jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ infer_jenkins_opts() {
inferred_jenkins_opts="${inferred_jenkins_opts} --httpListenAddress=${JENKINS_LISTEN_ADDRESS}"
fi

if [ -n "${JENKINS_UNIX_DOMAIN_PATH}" ]; then
inferred_jenkins_opts="${inferred_jenkins_opts} --httpUnixDomainPath=${JENKINS_UNIX_DOMAIN_PATH}"
fi

if [ -n "${JENKINS_HTTPS_PORT}" ]; then
inferred_jenkins_opts="${inferred_jenkins_opts} --httpsPort=${JENKINS_HTTPS_PORT}"
fi
Expand Down Expand Up @@ -117,6 +121,7 @@ main() {
unset JENKINS_HTTPS_PORT
java_cmd="${JENKINS_JAVA_CMD}"
unset JENKINS_JAVA_CMD
unset JENKINS_UNIX_DOMAIN_PATH
unset JENKINS_LISTEN_ADDRESS
unset JENKINS_LOG
unset JENKINS_OPTS
Expand Down Expand Up @@ -157,6 +162,7 @@ check_env \
JAVA_OPTS \
JENKINS_HTTPS_PORT \
JENKINS_JAVA_CMD \
JENKINS_UNIX_DOMAIN_PATH \
JENKINS_LISTEN_ADDRESS \
JENKINS_LOG \
JENKINS_OPTS \
Expand Down