Skip to content

Commit

Permalink
Switch jenkins-remoting-runner from GoReleaser to nFPM.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Apr 9, 2024
1 parent 01cb171 commit 2312041
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 85 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/_build-and-cache-nfpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: "🎯 Step: Build and cache (nFPM)"
on:
workflow_call:
inputs:
package-name:
required: true
type: string
package-version:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build-and-cache-nfpm
cancel-in-progress: true

# Variables available to all jobs defined in this file
env:
DOCKER_BUILDKIT: 1
REGISTRY: ${{ vars.REGISTRY }}

# Declare default permissions as read only.
permissions: read-all

jobs:
generate:
runs-on: ubuntu-latest
name: "📦 Build and cache (nFPM)"
strategy:
fail-fast: false

container:
image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: --privileged

steps:
- name: Git clone
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.base_ref }}

- name: "📦 Build the package (nFPM)"
working-directory: packages/${{ inputs.package-name }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GPG_KEY_B64: ${{ secrets.GPG_KEY_B64 }}
NFPM_PASSPHRASE: "${{ secrets.GPG_PWD }}"
PKG_VER: "${{ inputs.package-version }}"
RSA_KEY_B64: ${{ secrets.RSA_KEY_B64 }}
run: |
# Decode the contents into files.
echo -n "${GPG_KEY_B64}" | base64 --decode > 3C7658F0.asc
echo -n "${RSA_KEY_B64}" | base64 --decode > signing.pem
# Build the package
mkdir -p ./dist
nfpm package --packager apk --target ./dist
nfpm package --packager deb --target ./dist
nfpm package --packager rpm --target ./dist
- name: Cache the packages
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache-packages
with:
key: "${{ inputs.package-name }}-${{ inputs.package-version }}"
path: packages/${{ inputs.package-name }}/dist
7 changes: 3 additions & 4 deletions .github/workflows/build-jenkins-remoting-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ jobs:
pip install --upgrade yq
echo "package_version=$(
curl -sSL https://repo.jenkins-ci.org/artifactory/public/org/jenkins-ci/main/remoting/maven-metadata.xml \
| xq -Mr '.metadata.versioning.latest' \
| sed -r 's,\..*,.0.0,'
| xq -Mr '.metadata.versioning.latest'
)" >> $GITHUB_OUTPUT
- name: Check to see if we've already built this version
Expand All @@ -82,8 +81,8 @@ jobs:
build:
if: needs.lookup.outputs.cache_hit != 'true'
needs: lookup
name: "📦 Build and cache"
uses: northwood-labs/package-building/.github/workflows/_build-and-cache.yml@main
name: "📦 Build and cache (nFPM)"
uses: northwood-labs/package-building/.github/workflows/_build-and-cache-nfpm.yml@main
secrets: inherit
with:
package-name: "jenkins-remoting-runner"
Expand Down
81 changes: 0 additions & 81 deletions packages/jenkins-remoting-runner/.goreleaser.yml

This file was deleted.

51 changes: 51 additions & 0 deletions packages/jenkins-remoting-runner/nfpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: jenkins-remoting-runner
arch: all
platform: linux
version: ${PKG_VER}
version_schema: none
version_metadata: git
release: 1
section: default
maintainer: Northwood Labs <[email protected]>
description: |-
Jenkins Remoting is primarily used in communications between the Jenkins
controller and Jenkins agents.
vendor: jenkins-remoting-runner authors
homepage: https://www.jenkins.io/projects/remoting/
license: MIT
disable_globbing: false
provides:
- jenkins-remoting-runner
suggests:
- java-1.8.0-amazon-corretto
- java-11-amazon-corretto
- java-17-amazon-corretto
- java-21-amazon-corretto
- openjdk8
- openjdk11
- openjdk17
- openjdk21
contents:
- src: /opt/jenkins/jenkins-remoting-runner.jar
dst: /opt/jenkins/jenkins-remoting-runner.jar
- src: /usr/local/bin/jenkins-remoting-runner
dst: /usr/local/bin/jenkins-remoting-runner
file_info:
mode: 0755
umask: 0o002
scripts:
postinstall: postinstall.sh
rpm:
summary: "{{ .Var.Description }}"
packager: Northwood Labs <[email protected]>
compression: lzma
signature:
key_file: 3C7658F0.asc
deb:
signature:
key_file: 3C7658F0.asc
type: archive
apk:
signature:
key_file: signing.pem
key_name: "[email protected]"

0 comments on commit 2312041

Please sign in to comment.