+jenkins.io (#4926)

* new file:   projects/jenkins.io/package.yml

* debug

* find FREE_PORT for test

* grep <html>
This commit is contained in:
Andrew 2024-01-21 13:58:14 +02:00 committed by GitHub
parent 0d0228f300
commit 88315c364a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,65 @@
distributable:
url: https://get.jenkins.io/war-stable/2.426.2/jenkins.war
versions:
url: https://www.jenkins.io/download/
match: /\d+\.\d+\.\d+\/jenkins\.war/
strip: /\/jenkins\.war/
warnings:
- vendored
dependencies:
openjdk.org: '<20'
runtime:
env:
JENKINS_HOME: ${{prefix}}/var/jenkins
build:
- run: mkdir -p libexec/lib bin var/jenkins
working-directory: ${{prefix}}
- jar xvf jenkins.io-{{version}}.war
- cp -r jenkins.io-{{version}}.war {{prefix}}/libexec/lib/
- cp -r WEB-INF/lib/* {{prefix}}/libexec/lib/
- run: |
cat > jenkins-lts <<EOF
#!/bin/sh
exec java -jar \$(dirname \$0)/../libexec/lib/jenkins.io-{{version}}.war "\$@"
EOF
chmod +x jenkins-lts
working-directory: ${{prefix}}/bin
- run: |
cat > jenkins-lts-cli <<EOF
#!/bin/sh
exec java -jar \$(dirname \$0)/../libexec/lib/cli-{{version}}.jar "\$@"
EOF
chmod +x jenkins-lts-cli
working-directory: ${{prefix}}/bin
provides:
- bin/jenkins-lts
- bin/jenkins-lts-cli
test:
dependencies:
curl.se: '*'
script:
- run: |
for i in $(seq 1 10); do
FREE_PORT=$((RANDOM % 10000 + 1024))
if ! nc -z localhost $FREE_PORT; then
echo $FREE_PORT
fi
done
- mkdir -p tmp var/jenkins
- jenkins-lts --version | grep {{version}}
- jenkins-lts --httpPort=$FREE_PORT > var/jenkins/jenkins.log 2>&1 &
- PID=$!
- sleep 30
- curl -L localhost:$FREE_PORT -o output.html
- kill $PID || cat var/jenkins/jenkins.log # debug
- cat output.html | grep '<html>'
env:
_JAVA_OPTIONS: -Djava.io.tmpdir=$PWD/tmp $_JAVA_OPTIONS
JENKINS_HOME: $PWD/var/jenkins