Jenkins: Difference between revisions
imported>Qknight No edit summary |
Category:Server Category:Applications. Beginning sentence. |
||
Line 1: | Line 1: | ||
Jenkins is an extendable open source continuous integration server. | |||
== services.jenkins activation== | == services.jenkins activation== | ||
Line 106: | Line 108: | ||
[https://github.com/mrVanDalo mrVanDalo] has a [https://git.ingolf-wagner.de/palo/nixos-config/src/branch/main/nixos/library/jenkins.nix library] to declare jenkins in his repository. It can be used as shown [https://git.ingolf-wagner.de/palo/nixos-config/src/branch/main/nixos/configs/workhorse/jenkins.nix here] | [https://github.com/mrVanDalo mrVanDalo] has a [https://git.ingolf-wagner.de/palo/nixos-config/src/branch/main/nixos/library/jenkins.nix library] to declare jenkins in his repository. It can be used as shown [https://git.ingolf-wagner.de/palo/nixos-config/src/branch/main/nixos/configs/workhorse/jenkins.nix here] | ||
[[Category:Server]] | |||
[[Category:Applications]] |
Revision as of 17:57, 19 April 2024
Jenkins is an extendable open source continuous integration server.
services.jenkins activation
Write this into your /etc/nixos/configuration.nix
services.jenkins = { enable = true; };
After a `nixos-rebuild switch`
Then the program is available via webbrowser at:
CI configuration
Using the multibranch pipeline one can use this Jenkinsfile in the repository to build it:
pipeline { agent any environment { PATH="/run/current-system/sw/bin" } stages { stage('Build') { steps { echo 'Building..' sh 'ls' sh 'nix-shell --command "just build"' archiveArtifacts artifacts: 'frontend/dist/*', fingerprint: true } } stage('Test') { steps { echo 'Testing..' sh 'nix-shell --command "just test"' } } stage('Check fmt') { steps { echo 'Checking fmt..' sh 'nix-shell --command "cargo fmt --check"' sh 'nix-shell --command "cd frontend; cargo fmt --check"' } } } post { changed { script { if (currentBuild.currentResult == 'FAILURE') { emailext subject: '$DEFAULT_SUBJECT', body: '$DEFAULT_CONTENT', recipientProviders: [ [$class: 'CulpritsRecipientProvider'], [$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider'] ], replyTo: '$DEFAULT_REPLYTO', to: '$DEFAULT_RECIPIENTS' } } } always { cleanWs(cleanWhenNotBuilt: false, deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true, patterns: [[pattern: '.gitignore', type: 'INCLUDE'], [pattern: '.propsfile', type: 'EXCLUDE']]) } } }
reverse proxy
services.nginx = { enable = true; recommendedGzipSettings = true; recommendedOptimisation = true; virtualHosts = { jenkins = { serverName = "ci.example.com"; serverAliases = [ "ci-static.example.com" ]; forceSSL = true; enableACME = true; locations = { "/" = { proxyPass = "http://127.0.0.1:8080/"; }; }; }; };
You might want to enable the firewall using:
networking.firewall.enable = true;
using email
Use <https://gitlab.com/simple-nixos-mailserver> for email support. Can be tested using a test button from the <localhost:8080> webpage.
building nix projects
jenkins-nix-ci: A NixOS module for Jenkins, optimized specifically for running projects using Nix.
mrVanDalo has a library to declare jenkins in his repository. It can be used as shown here