From nobody Tue Oct 10 16:54:19 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S4hnm0Q9fz4x1yq; Tue, 10 Oct 2023 16:54:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S4hnl5sBsz4dxJ; Tue, 10 Oct 2023 16:54:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696956859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h1HJc7os3gIO/KsTrkfboRGWxbqkgBLtvTQZT5iNCoc=; b=KDDz6iWUij6TdXpaoUpzAuihv/0sSgH0Ocp/6GaYgwGj2OvIuan1f11hraAogteoESChbd HnGRCPB8u6I5N9MN8+TIbw2o89KlxG+3uWDhK4byq8onYi302NKlKT1mo1v9RU2RSZM7Us S2B0T9Vm470aq2IoNTpFdsUORtt9ZNPKF87YuvLZ8JFm2RLZ9eJIyIXHzvE6X3OxlxmFVH QR/SWY7Mpe4nRcZI/gcyvshhIrP/GxBKO8zkqLZzSfQjBhGgZfcqm+qv2PUvIPwNpid3LO tPIrnEX9G8YWZe9ldSMyeKaVwAC131tVBXE1rfQigaHLl8Px3/i5FVB06DLl7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696956859; a=rsa-sha256; cv=none; b=nBMxBRXjpa7mg1he+86DezlIzc5SJhaKuPPj5lRQTygDrGOkGqxGw2TAMP6cgz9SLr6tud NuyIGAtddZi6Kjpf2Vw8sMlGrLQLAlbXa4EcAQ6JIRI1XhlMeB89NFLl4F4MpyWKKDBIWv nSbdHRzWE8BB1XKYdH30G7ytYGcTBRyNULa+o5NmIuTVrYisCjCp7lbxKe8J/NQQXFax/M D9IWzMK8H7HtHKxgMqL7w19UiWHbSTD/ZoYrT85B5Nr0MA+hKiGraXkOBNINISzsTxp0mR kENGX/R/U+j8q9Mu597fAz4rrh5M+PfeiYm2Bn7u/yWWgcW3g3Jwt4kaqplnjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696956859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h1HJc7os3gIO/KsTrkfboRGWxbqkgBLtvTQZT5iNCoc=; b=PMDs0JWNDBwlc1y4PvH5bbQESnW/E+6TPRim43V1/jictMc8rE+YT5CGUF0jrDhikIpPwV N3yhbuTHCyAcQ/x5SLQemKjuG7HGxNXMwAk9aPgHXUJWFabVjFycZswEUsDA92GRaY3iec i5vmRO0UGI70bgdX+ljAe4pk6ZmKM0mBc6Psn4JQWqyHjFf+43++ZNAqyQo8HXKDyQ5DHi /hhwsyP4pJDyZwwf9kE/fX8Tlt/wQrFyTAGOTxvM3Z47WYd386jlHckILX95eLXm4VFzSs ms3LU4IpoxCOk2QG99Sft6+2wLhADWXs1L/BufZy5iPfwMZNg9keAFCPxFrPFg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S4hnl4vmGzmjH; Tue, 10 Oct 2023 16:54:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39AGsJ3r037073; Tue, 10 Oct 2023 16:54:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39AGsJfe037070; Tue, 10 Oct 2023 16:54:19 GMT (envelope-from git) Date: Tue, 10 Oct 2023 16:54:19 GMT Message-Id: <202310101654.39AGsJfe037070@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Danilo G. Baio" Subject: git: 849ebe16728a - main - devel/cirrus-cli: Add rc.d support List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dbaio X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 849ebe16728a9ccc3b2bf6334b7cd21827fb687b Auto-Submitted: auto-generated The branch main has been updated by dbaio: URL: https://cgit.FreeBSD.org/ports/commit/?id=849ebe16728a9ccc3b2bf6334b7cd21827fb687b commit 849ebe16728a9ccc3b2bf6334b7cd21827fb687b Author: Danilo G. Baio AuthorDate: 2023-10-09 20:52:11 +0000 Commit: Danilo G. Baio CommitDate: 2023-10-10 16:52:02 +0000 devel/cirrus-cli: Add rc.d support Approved by: bofh (maintainer) Differential Revision: https://reviews.freebsd.org/D42140 --- GIDs | 2 +- UIDs | 2 +- devel/cirrus-cli/Makefile | 15 +++++++++++--- devel/cirrus-cli/files/cirrus-cli.in | 34 ++++++++++++++++++++++++++++++++ devel/cirrus-cli/files/cirrus-worker.yml | 12 +++++++++++ devel/cirrus-cli/files/pkg-message.in | 11 +++++++++++ devel/cirrus-cli/pkg-plist | 8 ++++++++ 7 files changed, 79 insertions(+), 5 deletions(-) diff --git a/GIDs b/GIDs index 92053d2e8a01..fb89fc644b5f 100644 --- a/GIDs +++ b/GIDs @@ -769,7 +769,7 @@ selenium:*:824: polw:*:825: statsd:*:826: _tuptime:*:827: -# free: 828 +cirrus:*:828: # free: 829 # free: 830 # free: 831 diff --git a/UIDs b/UIDs index 37c8a75bed22..d3900898c438 100644 --- a/UIDs +++ b/UIDs @@ -775,7 +775,7 @@ selenium:*:824:824::0:0:Selenium Daemon User:/usr/local/selenium:/bin/sh polw:*:825:825::0:0:Policyd-weight Cache Owner:/nonexistent:/sbin/nologin statsd:*:826:826::0:0:Statsd Daemon:/nonexistent:/sbin/nologin _tuptime:*:827:827::0:0:Tuptime:/var/lib/tuptime:/usr/sbin/nologin -# free: 828 +cirrus:*:828:828::0:0:Cirrus CI:/usr/local/cirrus:/bin/sh # free: 829 # free: 830 # free: 831 diff --git a/devel/cirrus-cli/Makefile b/devel/cirrus-cli/Makefile index a60ac7079c85..43a98cca6460 100644 --- a/devel/cirrus-cli/Makefile +++ b/devel/cirrus-cli/Makefile @@ -1,9 +1,10 @@ PORTNAME= cirrus-cli PORTVERSION= 0.106.0 DISTVERSIONPREFIX= v +PORTREVISION= 1 CATEGORIES= devel -MASTER_SITES= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONFULL}/:gomod -DISTFILES= go.mod:gomod +MASTER_SITES= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONFULL}/:gomod +DISTFILES= go.mod:gomod MAINTAINER= bofh@FreeBSD.org COMMENT= Command line interface for Cirrus CI @@ -16,10 +17,18 @@ USES= go:modules USE_GITHUB= yes GH_ACCOUNT= cirruslabs +USE_RC_SUBR= ${PORTNAME} + GO_MODULE= github.com/cirruslabs/cirrus-cli GO_TARGET= ./cmd/cirrus GO_BUILDFLAGS= -ldflags="-X github.com/cirruslabs/cirrus-cli/internal/version.Version=${PORTVERSION}" -PLIST_FILES= bin/cirrus +SUB_FILES= pkg-message + +USERS= cirrus +GROUPS= cirrus + +post-install: + ${INSTALL_DATA} ${FILESDIR}/cirrus-worker.yml ${STAGEDIR}${PREFIX}/etc/cirrus-worker.yml.sample .include diff --git a/devel/cirrus-cli/files/cirrus-cli.in b/devel/cirrus-cli/files/cirrus-cli.in new file mode 100644 index 000000000000..cb531a48f7cc --- /dev/null +++ b/devel/cirrus-cli/files/cirrus-cli.in @@ -0,0 +1,34 @@ +#!/bin/sh + +# PROVIDE: cirrus_cli +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Options to configure cirrus-cli via /etc/rc.conf: +# +# cirrus_cli_enable (bool) Enable service on boot +# Default: NO +# +# cirrus_cli_conf (str) Config file to use +# Default: %%ETCDIR%%/cirrus-worker.yml +# +# cirrus_cli_uid (str) User to run cirrus_cli as +# Default: cirrus + +. /etc/rc.subr + +name="cirrus" +rcvar="cirrus_cli_enable" +pidfile="/var/run/cirrus-cli.pid" +procname="%%PREFIX%%/bin/cirrus" + +load_rc_config $name + +: ${cirrus_cli_enable:="NO"} +: ${cirrus_cli_conf:="%%PREFIX%%/etc/cirrus-worker.yml"} +: ${cirrus_cli_uid:="cirrus"} + +command="/usr/sbin/daemon" +command_args="-p ${pidfile} -u ${cirrus_cli_uid} ${procname} worker run -f ${cirrus_cli_conf}" + +run_rc_command "$1" diff --git a/devel/cirrus-cli/files/cirrus-worker.yml b/devel/cirrus-cli/files/cirrus-worker.yml new file mode 100644 index 000000000000..26d893e9d85f --- /dev/null +++ b/devel/cirrus-cli/files/cirrus-worker.yml @@ -0,0 +1,12 @@ +token: CHANGEME + +name: cirrus1-on-premises-change-me + +labels: + jail: FreeBSD + +log: + level: info + file: /usr/local/cirrus/cirrus-worker.log + rotate-size: 100 MB + max-rotations: 10 diff --git a/devel/cirrus-cli/files/pkg-message.in b/devel/cirrus-cli/files/pkg-message.in new file mode 100644 index 000000000000..72efed9b5a12 --- /dev/null +++ b/devel/cirrus-cli/files/pkg-message.in @@ -0,0 +1,11 @@ +[ +{ type: install + message: <