From 8428dc9b1a20fb3b158235bea8b054a0651933ac Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Mon, 24 Nov 2025 15:01:08 -0600 Subject: [PATCH 1/2] Refactor GitHub Actions workflow to build Docker image and run man page generation in container Signed-off-by: Stephen Simpson --- .github/workflows/build.yml | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ac6e8d..a550712 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,39 +25,26 @@ on: jobs: build: runs-on: ubuntu-latest - container: - image: rockylinux:9 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install system dependencies + - name: Build Docker image run: | - dnf install -y \ - python3.11 \ - python3.11-pip \ - mandoc \ - rpm-build \ - dnf-plugins-core \ - git + docker build -t rocky-man:latest . - - name: Install UV + - name: Create output directories run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - echo "$HOME/.cargo/bin" >> $GITHUB_PATH + mkdir -p ./html ./tmp - - name: Install Python dependencies + - name: Build man pages in container run: | - uv pip install --system -e . - - - name: Build man pages - run: | - python3.11 -m rocky_man.main \ - --versions ${{ github.event.inputs.versions || '8.10 9.5' }} \ - --output-dir ./html \ - --download-dir ./tmp/downloads \ - --extract-dir ./tmp/extracts \ + docker run --rm \ + -v "$(pwd)/html:/data/html" \ + -v "$(pwd)/tmp:/data/tmp" \ + rocky-man:latest \ + --versions ${{ github.event.inputs.versions || '8.10 9.6 10.0' }} \ --verbose env: PYTHONUNBUFFERED: 1 -- 2.49.1 From 29f299f984d513bb2dc2413bab735ecc84072463 Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Mon, 24 Nov 2025 15:19:32 -0600 Subject: [PATCH 2/2] Remove GitHub Pages deployment step from build workflow and add Jenkinsfile for Kubernetes-based builds Signed-off-by: Stephen Simpson --- .github/workflows/build.yml | 8 --- Jenkinsfile | 114 ++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 Jenkinsfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a550712..b40a5c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,11 +55,3 @@ jobs: name: rocky-man-pages path: html/ retention-days: 30 - - - name: Deploy to GitHub Pages - if: github.ref == 'refs/heads/main' - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./html - force_orphan: true diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..b0f6b10 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,114 @@ +// Jenkinsfile for Rocky Man +// This pipeline uses Kubernetes agents to build and run the container + +pipeline { + agent { + kubernetes { + yaml """ +apiVersion: v1 +kind: Pod +metadata: + labels: + jenkins: agent +spec: + containers: + - name: docker + image: docker:24-dind + securityContext: + privileged: true + volumeMounts: + - name: docker-sock + mountPath: /var/run + command: + - dockerd-entrypoint.sh + - name: docker-cli + image: docker:24-cli + command: + - cat + tty: true + volumeMounts: + - name: docker-sock + mountPath: /var/run + volumes: + - name: docker-sock + emptyDir: {} +""" + } + } + + parameters { + string( + name: 'VERSIONS', + defaultValue: '8.10 9.6 10.0', + description: 'Rocky Linux versions to build (space-separated)' + ) + } + + options { + buildDiscarder(logRotator(numToKeepStr: '10')) + timeout(time: 2, unit: 'HOURS') + timestamps() + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Build Docker Image') { + steps { + container('docker-cli') { + sh ''' + docker build -t rocky-man:${BUILD_NUMBER} . + docker tag rocky-man:${BUILD_NUMBER} rocky-man:latest + ''' + } + } + } + + stage('Build Man Pages') { + steps { + container('docker-cli') { + sh ''' + # Create output directories + mkdir -p ./html ./tmp + + # Run the container to build man pages + docker run --rm \ + -v "$(pwd)/html:/data/html" \ + -v "$(pwd)/tmp:/data/tmp" \ + rocky-man:${BUILD_NUMBER} \ + --versions ${VERSIONS} \ + --verbose + ''' + } + } + } + + stage('Archive Artifacts') { + steps { + archiveArtifacts artifacts: 'html/**/*', fingerprint: true + } + } + } + + post { + success { + echo 'Build completed successfully!' + } + failure { + echo 'Build failed!' + } + cleanup { + container('docker-cli') { + sh ''' + # Clean up Docker images to save space + docker rmi rocky-man:${BUILD_NUMBER} || true + docker rmi rocky-man:latest || true + ''' + } + } + } +} -- 2.49.1