commit f8a444c170284d61ad8740a3ad21985423dbb836 Author: CentOS Sources Date: Tue Nov 15 01:26:43 2022 -0500 import weldr-client-35.5-4.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b1eca1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/gpg-117E8C168EFE3A7F.key +SOURCES/weldr-client-35.5.tar.gz diff --git a/.weldr-client.metadata b/.weldr-client.metadata new file mode 100644 index 0000000..dbe2dd5 --- /dev/null +++ b/.weldr-client.metadata @@ -0,0 +1,2 @@ +9a95f2c777b4fca2c9c5705ed330cafcf1b09555 SOURCES/gpg-117E8C168EFE3A7F.key +089128c30d8aa218304d0bb8d571f9a6d45aba72 SOURCES/weldr-client-35.5.tar.gz diff --git a/SOURCES/0001-tests-Update-tests-for-osbuild-composer-changes.patch b/SOURCES/0001-tests-Update-tests-for-osbuild-composer-changes.patch new file mode 100644 index 0000000..d0d61eb --- /dev/null +++ b/SOURCES/0001-tests-Update-tests-for-osbuild-composer-changes.patch @@ -0,0 +1,47 @@ +From b1d63edcd830a5a23eaa838f536769681db24acb Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 14 Jun 2022 13:43:45 -0700 +Subject: [PATCH] tests: Update tests for osbuild-composer changes + +Cancel when the build is in the wrong state now returns a proper error, +and ostree composes now accept the refid, parent, and the url without +returning an error. +--- + weldr/compose_test.go | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/weldr/compose_test.go b/weldr/compose_test.go +index f937510..fb2fa42 100644 +--- a/weldr/compose_test.go ++++ b/weldr/compose_test.go +@@ -97,14 +97,12 @@ func TestStartOSTreeComposeUrl(t *testing.T) { + assert.Greater(t, len(id), 0) + } + +-func TestStartOSTreeComposeUrlError(t *testing.T) { +- // Sending both the parent url and the parent id should return an error ++func TestStartOSTreeUrlParentError(t *testing.T) { ++ // Sending both the parent url and the parent id is now allowed + id, r, err := testState.client.StartOSTreeComposeTest("cli-test-bp-1", "qcow2", "refid", "parent", "http://weldr.io", 0, 2) + require.Nil(t, err) +- require.NotNil(t, r) +- assert.False(t, r.Status) +- assert.Equal(t, APIErrorMsg{"OSTreeOptionsError", "Supply at most one of Parent and URL"}, r.Errors[0]) +- assert.Equal(t, len(id), 0) ++ require.Nil(t, r) ++ assert.Greater(t, len(id), 0) + } + + func TestStartOSTreeComposeUpload(t *testing.T) { +@@ -196,7 +194,7 @@ func TestCancelFinishedCompose(t *testing.T) { + require.NotNil(t, status) + assert.False(t, status.Status) + require.GreaterOrEqual(t, len(r), 1) +- assert.Equal(t, APIErrorMsg{"InternalServerError", "Internal server error: job does not exist"}, r[0]) ++ assert.Equal(t, APIErrorMsg{"BuildInWrongState", fmt.Sprintf("Build %s is not in WAITING or RUNNING.", id)}, r[0]) + } + + func TestCancelComposeUnknown(t *testing.T) { +-- +2.37.1 + diff --git a/SOURCES/weldr-client-35.5.tar.gz.asc b/SOURCES/weldr-client-35.5.tar.gz.asc new file mode 100644 index 0000000..f3bfd06 --- /dev/null +++ b/SOURCES/weldr-client-35.5.tar.gz.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- + +iQEzBAABCgAdFiEEtMa0UeT6i0IyyhkeEX6MFo7+On8FAmIK0YcACgkQEX6MFo7+ +On8CfAf7BSNtG3oQKc9KxmN+D7hS/IHliKpAWRhF+kNZDshytLZeISuB8yjDlXJ8 +LMVifzmkumoZTwYsk74TGJjL/j/wTo6RAE5+OEIQIftvidihahNUH5WM6XrbSVAA +ygB3NgrhaGTnk8TRHNNnY26CJ6drY6MTNB3V+JFXtVlx/EgH+LHHLrXOA6f5I+3h +TKMzxJOXgXb1yDrSdVJYj1IToGmwT+QsiCmzciYCykshRaoe9hGfrDPoC4xGjdVx +OreX9x/tmPuPqQhXK40CqVX2rGMzjMf78/01dDiWHatOKepHdGy0N7VFwLQ8/f0Q +QD0Yq3i0JMzzS28NAszNdQdIeAD7BA== +=A1hY +-----END PGP SIGNATURE----- diff --git a/SPECS/weldr-client.spec b/SPECS/weldr-client.spec new file mode 100644 index 0000000..ad20674 --- /dev/null +++ b/SPECS/weldr-client.spec @@ -0,0 +1,161 @@ +# Pass --with tests to rpmbuild to build composer-cli-tests +%bcond_with tests +# Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION) +%bcond_without signed + +%global goipath github.com/osbuild/weldr-client/v2 + +Name: weldr-client +Version: 35.5 +Release: 4%{?dist} +# Upstream license specification: Apache-2.0 +License: ASL 2.0 +Summary: Command line utility to control osbuild-composer +Url: %{gourl} +Source0: https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz +%if %{with signed} +Source1: https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc +Source2: https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key +%endif + +Patch0001: 0001-tests-Update-tests-for-osbuild-composer-changes.patch + +Obsoletes: composer-cli < 35.0 +Provides: composer-cli = %{version}-%{release} + +%gometa + +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +%if 0%{?fedora} +BuildRequires: golang(github.com/BurntSushi/toml) +BuildRequires: golang(github.com/spf13/cobra) +# Required for tests and %check +BuildRequires: golang(github.com/stretchr/testify/assert) +BuildRequires: golang(github.com/stretchr/testify/require) +%endif + +BuildRequires: git-core +BuildRequires: make +BuildRequires: gnupg2 + + +%description +Command line utility to control osbuild-composer + +%prep +%if %{with signed} +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%endif +%if 0%{?rhel} +%forgeautosetup -p1 +%else +%goprep +%endif + +%build +export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} " + +%if 0%{?rhel} +GO_BUILD_PATH=$PWD/_build +install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath}) +ln -fs $PWD $GO_BUILD_PATH/src/%{goipath} +cd $GO_BUILD_PATH/src/%{goipath} +install -m 0755 -vd _bin +export PATH=$PWD/_bin${PATH:+:$PATH} +export GOPATH=$GO_BUILD_PATH:%{gopath} +export GOFLAGS=-mod=vendor +%else +export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" +export GO111MODULE=off +%endif +%gobuild -o composer-cli %{goipath}/cmd/composer-cli + + +## TODO +##make man + +%if %{with tests} || 0%{?rhel} +export BUILDTAGS="integration" + +# Build test binaries with `go test -c`, so that they can take advantage of +# golang's testing package. The RHEL golang rpm macros don't support building them +# directly. Thus, do it manually, taking care to also include a build id. +# +# On Fedora go modules have already been turned off, and the path set to the one into which +# the golang-* packages install source code. +export LDFLAGS="${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')" +go test -c -tags=integration -buildmode pie -compiler gc -ldflags="${LDFLAGS}" -o composer-cli-tests %{goipath}/weldr +%endif + +%install +make DESTDIR=%{buildroot} install + +%if %{with tests} || 0%{?rhel} +make DESTDIR=%{buildroot} install-tests +%endif + +%check +%if 0%{?fedora} +export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" +export GO111MODULE=off +%endif + +# Run the unit tests +export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} " +make test + + +%files +%license LICENSE +%doc examples HACKING.md README.md +%{_bindir}/composer-cli +%dir %{_sysconfdir}/bash_completion.d +%{_sysconfdir}/bash_completion.d/composer-cli +%{_mandir}/man1/composer-cli* + +%if %{with tests} || 0%{?rhel} +%package tests +Summary: Integration tests for composer-cli + +%description tests +Integration tests to be run on a pristine-dedicated system to test the +composer-cli package. + +%files tests +%license LICENSE +%{_libexecdir}/tests/composer-cli/ +%endif + + +%changelog +* Wed Aug 24 2022 Brian C. Lane - 35.5-4 +- tests: Add osbuild-composer repo file for RHEL 9.1 + Related: rhbz#2118831 + +* Tue Aug 23 2022 Brian C. Lane - 35.5-3 +- tests: Update tests for osbuild composer changes + Resolves: rhbz#2118831 + +* Wed Feb 16 2022 Brian C. Lane - 35.5-2 +- Switch to tmt tests instead of STI and update repo urls + Related: rhbz#2052601 + +* Tue Feb 15 2022 Brian C. Lane - 35.5-1 +- New release: 35.5 (bcl) + Resolves: rhbz#2052601 +- docs: Explain how to undo blueprints delete (bcl) +- test: server status no longer returns devel (bcl) +- Use GetFrozenBlueprintsTOML for blueprints freeze save (bcl) +- Add a test for float uid/gid in frozen blueprint (bcl) +- Use GetBlueprintsTOML for blueprints save (bcl) +- test: Add a test for float uid/gid in saved blueprint (bcl) +- build(deps): bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0 (49699333+dependabot[bot]) +- tests: trigger on push to main (jrusz) +- build(deps): bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (49699333+dependabot[bot]) +- ci: add keystore for sonarqube (jrusz) +- spec: Switch to using %%gobuild macro on Fedora (bcl) +- ci: change workflow name (jrusz) +- ci: add gitlab-ci and sonarqube (jrusz) +- doc: fix example links from the README (tdecacqu) +- build(deps): bump actions/checkout from 2.3.4 to 2.4.0 (49699333+dependabot[bot]) +- ci: Enable Coverity Scan tool (atodorov)