From a5eb62a7ec9a8c989e06a7fcfb2ef59feae85934dfcfd111c9ad89a2e50523d2 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Mon, 29 Jul 2024 15:51:22 +0000 Subject: [PATCH] new package woodpecker: server, agent and CLI for the Woodpecker CI system OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/woodpecker?expand=0&rev=1 --- .gitattributes | 23 +++++ .gitignore | 1 + Makefile | 30 ++++++ PACKAGING_README.md | 14 +++ _service | 22 +++++ _servicedata | 4 + system-user-woodpecker.conf | 2 + vendor.tar.gz | 3 + web-2.7.0.tar.gz | 3 + woodpecker-2.7.0.obscpio | 3 + woodpecker-agent.service | 18 ++++ woodpecker-server.service | 18 ++++ woodpecker.changes | 122 ++++++++++++++++++++++++ woodpecker.obsinfo | 4 + woodpecker.spec | 183 ++++++++++++++++++++++++++++++++++++ 15 files changed, 450 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 PACKAGING_README.md create mode 100644 _service create mode 100644 _servicedata create mode 100644 system-user-woodpecker.conf create mode 100644 vendor.tar.gz create mode 100644 web-2.7.0.tar.gz create mode 100644 woodpecker-2.7.0.obscpio create mode 100644 woodpecker-agent.service create mode 100644 woodpecker-server.service create mode 100644 woodpecker.changes create mode 100644 woodpecker.obsinfo create mode 100644 woodpecker.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91f5d55 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +NAME = woodpecker +SPEC = woodpecker.spec + +default: clean tar + +clean: + rm -rf $(NAME) $(NAME)-*.tar $(NAME)-*.tar.gz $(NAME)-*.obscpio vendor.tar.gz web-*.tar.gz + +tar: + osc service manualrun + @version=$$( awk '/^Version:/ {print $$2;exit;}' $(SPEC) ) && \ + echo "Package version is $$version" && \ + basename=$(NAME)-$$version && \ + obscpio=$$basename.obscpio && \ + wd=$$(pwd) && \ + tmpdir=$$(mktemp -d -p /tmp) && \ + cd $$tmpdir && \ + echo "Extracting obscpio archive" && \ + cpio -id < $$wd/$$obscpio && \ + tar xvf $$wd/vendor.tar.gz && \ + cd $$basename/web/ && \ + rm -rf node_modules && \ + ls -lah && \ + pnpm install --frozen-lockfile && \ + pnpm build && \ + ls -lah && \ + cd .. && \ + tar czf $$wd/web-$$version.tar.gz ./web/ && \ + echo "DONE creating npm dependency offline cache file web-$$version.tar.gz" && \ + rm -rf $$tmpdir diff --git a/PACKAGING_README.md b/PACKAGING_README.md new file mode 100644 index 0000000..c242bb2 --- /dev/null +++ b/PACKAGING_README.md @@ -0,0 +1,14 @@ +# Packaging woodpecker + +This server package needs assets generated by the `Makefile` that is present in +this package. To do that, you need to have `make` and `nodejs-common` installed +locally. + +1. Change the version in the `_service` file +2. Enable `pnpm` by running `sudo corepack enable pnpm` +3. Run `make` +4. Create a changelog entry +5. Commit the changes as usual + +For the OBS workflow you also need `obs-service-go_modules` as well +as `obs-service-tar_scm` and `obs-service-recompress`. diff --git a/_service b/_service new file mode 100644 index 0000000..ee4da58 --- /dev/null +++ b/_service @@ -0,0 +1,22 @@ + + + https://github.com/woodpecker-ci/woodpecker + git + .git + v2.7.0 + @PARENT_TAG@ + enable + v(.*) + + + + + + + + + + *.tar + gz + + diff --git a/_servicedata b/_servicedata new file mode 100644 index 0000000..4927c2e --- /dev/null +++ b/_servicedata @@ -0,0 +1,4 @@ + + + https://github.com/woodpecker-ci/woodpecker + 805c3156f857c228e9094a96619b4d00a5e6f711 \ No newline at end of file diff --git a/system-user-woodpecker.conf b/system-user-woodpecker.conf new file mode 100644 index 0000000..57ebd90 --- /dev/null +++ b/system-user-woodpecker.conf @@ -0,0 +1,2 @@ +#Type Name ID GECOS Home Shell +u woodpecker - - /var/lib/woodpecker /usr/sbin/nologin diff --git a/vendor.tar.gz b/vendor.tar.gz new file mode 100644 index 0000000..ed6d9a9 --- /dev/null +++ b/vendor.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8477d1fae271927c4d068354ab7216171456804e77f133424f1188f2aab7fd1 +size 21626134 diff --git a/web-2.7.0.tar.gz b/web-2.7.0.tar.gz new file mode 100644 index 0000000..15aa68c --- /dev/null +++ b/web-2.7.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be657d6905f5c17ed4d02f2bd687fd686616149efc5ab635d9a59d0b1e0dfc5b +size 57955961 diff --git a/woodpecker-2.7.0.obscpio b/woodpecker-2.7.0.obscpio new file mode 100644 index 0000000..5bd3d2f --- /dev/null +++ b/woodpecker-2.7.0.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1152ce544bdebcb98d734351d8c137b85c84b21693ab7cb90c59940b692d8281 +size 40402445 diff --git a/woodpecker-agent.service b/woodpecker-agent.service new file mode 100644 index 0000000..34352d7 --- /dev/null +++ b/woodpecker-agent.service @@ -0,0 +1,18 @@ +[Unit] +Description=WoodpeckerCI agent +Documentation=https://woodpecker-ci.org/docs/administration/agent-config +Requires=network.target +After=network.target +ConditionFileNotEmpty=/etc/woodpecker/woodpecker-agent.env +ConditionPathExists=/etc/woodpecker/woodpecker-agent.env + +[Service] +Type=simple +EnvironmentFile=/etc/woodpecker/woodpecker-agent.env +User=woodpecker +Group=woodpecker +ExecStart=/usr/bin/woodpecker-agent +WorkingDirectory=/var/lib/woodpecker/ + +[Install] +WantedBy=multi-user.target diff --git a/woodpecker-server.service b/woodpecker-server.service new file mode 100644 index 0000000..9725cf4 --- /dev/null +++ b/woodpecker-server.service @@ -0,0 +1,18 @@ +[Unit] +Description=WoodpeckerCI server +Documentation=https://woodpecker-ci.org/docs/administration/server-config +Requires=network.target +After=network.target +ConditionFileNotEmpty=/etc/woodpecker/woodpecker-server.env +ConditionPathExists=/etc/woodpecker/woodpecker-server.env + +[Service] +Type=simple +EnvironmentFile=/etc/woodpecker/woodpecker-server.env +User=woodpecker +Group=woodpecker +ExecStart=/usr/bin/woodpecker-server +WorkingDirectory=/var/lib/woodpecker/ + +[Install] +WantedBy=multi-user.target diff --git a/woodpecker.changes b/woodpecker.changes new file mode 100644 index 0000000..68fbdd6 --- /dev/null +++ b/woodpecker.changes @@ -0,0 +1,122 @@ +------------------------------------------------------------------- +Sat Jul 20 14:54:52 UTC 2024 - opensuse_buildservice@ojkastl.de + +- Update to version 2.7.0: + * Security + - Add blocklist of environment variables who could alter + execution of plugins [#3934] + - Make sure plugins only mount the workspace base in a + predefinde location [#3933] + - Disallow to set arbitrary environments for plugins [#3909] + - Use proper oauth state [#3847] + - Enhance token checking [#3842] + - Bump github.com/hashicorp/go-retryablehttp v0.7.5 -> v0.7.7 + [#3834] + * Features + - Gracefully shutdown server [#3896] + - Gracefully shutdown agent [#3895] + - Convert urls in logs to links [#3904] + - Allow login using multiple forges [#3822] + - Global and organization registries [#1672] + - Cli get repo from git remote [#3830] + - Add api for forges [#3733] + * Enhancement + - Cli fix pipeline logs [#3913] + - Migrate to github.com/urfave/cli/v3 [#2951] + - Allow to change the working directory also for plugins and + services [#3914] + - Remove unplugin-icons [#3809] + - Release windows binaries as zip file [#3906] + - Convert to openapi 3.0 [#3897] + - Enhance pipeline list [#3898] + - Add user registries UI [#3888] + - Sort users by login [#3891] + - Exclude dummy backend in production [#3877] + - Fix deploy task env [#3878] + - Get default branch and show message in pipeline list [#3867] + - Add timestamp for last work done by agent [#3844] + - Adjust logger types [#3859] + - Cleanup state reporting [#3850] + - Unify DB tables/columns [#3806] + - Let webhook pass on pipeline parsing error [#3829] + - Exclude mocks from release build [#3831] + - K8s secrets reference from step [#3655] + * Bug Fixes + - Handle empty repositories in gitea when listing PRs [#3925] + - Update alpine package dep for docker images [#3917] + - Don't report error if agent was terminated gracefully [#3894] + - Let agents continuously report their health [#3893] + - Ignore warnings for cli exec [#3868] + - Correct favicon states [#3832] + - Cleanup of the login flow and tests [#3810] + - Fix newlines in logs [#3808] + - Fix authentication error handling [#3807] + * Documentation + - Streamline docs for new users [#3803] + - Add mastodon verification [#3843] + - chore(deps): update docs npm deps non-major [#3837] + - fix(deps): update docs npm deps non-major [#3824] + - Add openSUSE package [#3800] + - chore(deps): update docs npm deps non-major [#3798] + - Add "Docker Tags" Plugin [#3796] + - chore(deps): update dependency marked to v13 [#3792] + - chore: fix some comments [#3788] + * Misc + - chore(deps): update web npm deps non-major [#3930] + - chore(deps): update dependency vitest to v2 [#3905] + - fix(deps): update module github.com/google/go-github/v62 to + v63 [#3910] + - chore(deps): update + docker.io/woodpeckerci/plugin-docker-buildx docker tag to + v4.1.0 [#3908] + - Update plugin-git and add renovate trigger [#3901] + - chore(deps): update docker.io/mstruebing/editorconfig-checker + docker tag to v3.0.3 [#3903] + - fix(deps): update golang-packages [#3875] + - chore(deps): lock file maintenance [#3876] + - [pre-commit.ci] pre-commit autoupdate [#3862] + - Add dummy backend [#3820] + - chore(deps): update dependency replace-in-file to v8 [#3852] + - Update forgejo sdk [#3840] + - chore(deps): lock file maintenance [#3838] + - Allow to set dist dir using env var [#3814] + - chore(deps): lock file maintenance [#3805] + - chore(deps): update docker.io/lycheeverse/lychee docker tag + to v0.15.1 [#3797] + +------------------------------------------------------------------- +Sat Jul 20 08:34:11 UTC 2024 - opensuse_buildservice@ojkastl.de + +- Update to version 2.6.1: + * Fix Changelog + * Release 2.6.1 (#3935) + * Add blocklist of environment variables who could alter + execution of plugins (#3934) + * Make sure plugins only mount the workspace base in a predefinde + location (#3933) + * Disalow to set arbitrary environments for plugins (#3909) + * Bump github.com/hashicorp/go-retryablehttp v0.7.5 -> v0.7.7 + (#3833) + * Fix newlines in logs (#3808) + * Let webhook pass on pipeline parsion error + +------------------------------------------------------------------- +Fri Jun 14 15:21:40 UTC 2024 - opensuse_buildservice@ojkastl.de + +- Update to version 2.6.0: + * 🎉 Release 2.6.0 (#3751) + * Add 2.6 docs (#3786) + * Add release event to webhooks (#3784) + * Improve step logging (#3722) + * Remove misleading crontab guru suggestion from docs (#3781) + * Add documentation for KUBERNETES_SERVICE_HOST in Agent (#3747) + * Update nix flake (#3780) + * chore(deps): lock file maintenance (#3783) + * chore(deps): update pre-commit hook golangci/golangci-lint to v1.59.1 (#3782) + * Respect cli argument when checking docker backend availability (#3770) + +------------------------------------------------------------------- +Fri Jun 14 15:20:51 UTC 2024 - Johannes Kastl + +- new package woodpecker: server, agent and CLI for the Woodpecker + CI system diff --git a/woodpecker.obsinfo b/woodpecker.obsinfo new file mode 100644 index 0000000..2181e1e --- /dev/null +++ b/woodpecker.obsinfo @@ -0,0 +1,4 @@ +name: woodpecker +version: 2.7.0 +mtime: 1721337871 +commit: 805c3156f857c228e9094a96619b4d00a5e6f711 diff --git a/woodpecker.spec b/woodpecker.spec new file mode 100644 index 0000000..295679d --- /dev/null +++ b/woodpecker.spec @@ -0,0 +1,183 @@ +# +# spec file for package woodpecker +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define __arch_install_post export NO_BRP_STRIP_DEBUG=true + +%define cli_package_name woodpecker-cli +%define cli_executable_name woodpecker-cli + +%define agent_package_name woodpecker-agent +%define agent_executable_name woodpecker-agent + +%define server_package_name woodpecker-server +%define server_executable_name woodpecker-server + +Name: woodpecker +Version: 2.7.0 +Release: 0 +Summary: Simple yet powerful CI/CD engine with great extensibility +License: Apache-2.0 +URL: https://github.com/woodpecker-ci/woodpecker +Source: %{name}-%{version}.tar.gz +Source1: vendor.tar.gz +Source2: web-%{version}.tar.gz +Source11: woodpecker-server.service +Source12: woodpecker-agent.service +Source21: system-user-woodpecker.conf +BuildRequires: go >= 1.22 +BuildRequires: user(woodpecker) + +%description +Woodpecker is a simple yet powerful CI/CD engine with great extensibility + +%package -n %{cli_package_name} +Summary: CLI for the WoodpeckerCI system + +%description -n %{cli_package_name} +Woodpecker is a simple yet powerful CI/CD engine with great extensibility. This +package contains the command line utility for the WoodpeckerCI system + +%package -n %{agent_package_name} +Summary: Agent for the WoodpeckerCI system +Requires: user(woodpecker) + +%description -n %{agent_package_name} +Woodpecker is a simple yet powerful CI/CD engine with great extensibility. This +package contains the agent binary and service. + +%package -n %{server_package_name} +Summary: WoodpeckerCI server +Requires: user(woodpecker) + +%description -n %{server_package_name} +Woodpecker is a simple yet powerful CI/CD engine with great extensibility. This +package contains the server binary and service. + +%package -n system-user-%{name} +Summary: System user and group woodpecker +BuildRequires: sysuser-tools +BuildArch: noarch +%sysusers_requires + +%description -n system-user-%{name} +This package provides the system user for the woodpecker CI system. + +%prep +%autosetup -p 1 -a 1 +rm -rf web/ +tar xvf %{SOURCE2} + +%build +# CLI executable +go build \ + -mod=vendor \ + -buildmode=pie \ + -ldflags="-X go.woodpecker-ci.org/woodpecker/v2/version.Version=v%{version}" \ + -o bin/%{cli_executable_name} ./cmd/cli + +# Agent executable +go build \ + -mod=vendor \ + -buildmode=pie \ + -ldflags="-X go.woodpecker-ci.org/woodpecker/v2/version.Version=v%{version}" \ + -o bin/%{agent_executable_name} ./cmd/agent + +# Server +go build \ + -mod=vendor \ + -buildmode=pie \ + -ldflags="-X go.woodpecker-ci.org/woodpecker/v2/version.Version=v%{version}" \ + -o bin/%{server_executable_name} ./cmd/server + +# system-user +%sysusers_generate_pre %{SOURCE21} user + +%install +install -D -m 0755 bin/%{cli_executable_name} %{buildroot}/%{_bindir}/%{cli_executable_name} +install -D -m 0755 bin/%{agent_executable_name} %{buildroot}/%{_bindir}/%{agent_executable_name} +install -D -m 0755 bin/%{server_executable_name} %{buildroot}/%{_bindir}/%{server_executable_name} + +install -d -m 0750 %{buildroot}%{_sysconfdir}/woodpecker/ + +install -d -m 0750 %{buildroot}%{_sharedstatedir}/woodpecker/ + +install -d -m 0755 %{buildroot}%{_unitdir}/ +install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/woodpecker-server.service +install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/woodpecker-agent.service + +# system user +install -Dm644 %{SOURCE21} %{buildroot}%{_sysusersdir}/system-user-woodpecker.conf + +%check +bin/%{cli_executable_name} --version | grep %{version} +bin/%{agent_executable_name} --version | grep %{version} +bin/%{server_executable_name} --version | grep %{version} + +%pre -n system-user-%{name} -f user.pre + +%pre -n %{name}-server +%service_add_pre woodpecker-server.service + +%post -n %{name}-server +%service_add_post woodpecker-server.service + +%preun -n %{name}-server +%service_del_preun woodpecker-server.service + +%postun -n %{name}-server +%service_del_postun woodpecker-server.service + +%pre -n %{name}-agent +%service_add_pre woodpecker-agent.service + +%post -n %{name}-agent +%service_add_post woodpecker-agent.service + +%preun -n %{name}-agent +%service_del_preun woodpecker-agent.service + +%postun -n %{name}-agent +%service_del_postun woodpecker-agent.service + +%files -n %{cli_package_name} +%doc README.md +%license LICENSE +%{_bindir}/%{cli_executable_name} + +%files -n %{agent_package_name} +%doc README.md +%license LICENSE +%{_bindir}/%{agent_executable_name} +%{_unitdir}/woodpecker-agent.service +%dir %attr(750,woodpecker,woodpecker) %{_sysconfdir}/woodpecker/ +%config(noreplace) %attr(640,woodpecker,woodpecker) %ghost %{_sysconfdir}/woodpecker/woodpecker-agent.env +%dir %attr(750,woodpecker,woodpecker) %{_sharedstatedir}/woodpecker/ + +%files -n %{server_package_name} +%doc README.md +%license LICENSE +%{_bindir}/%{server_executable_name} +%{_unitdir}/woodpecker-server.service +%dir %attr(750,woodpecker,woodpecker) %{_sysconfdir}/woodpecker/ +%config(noreplace) %attr(640,woodpecker,woodpecker) %ghost %{_sysconfdir}/woodpecker/woodpecker-server.env +%dir %attr(750,woodpecker,woodpecker) %{_sharedstatedir}/woodpecker/ + +%files -n system-user-%{name} +%{_sysusersdir}/system-user-woodpecker.conf + +%changelog