diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.packit.yaml b/.packit.yaml index 8b284aa8..3c88ab38 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -2,98 +2,62 @@ # See the documentation for more information: # https://packit.dev/docs/configuration/ -# NOTE: The Packit copr_build tasks help to check if every commit builds on -# supported Fedora and CentOS Stream arches. -# They do not block the current Cirrus-based workflow. - downstream_package_name: skopeo upstream_tag_template: v{version} -packages: - skopeo-fedora: - pkg_tool: fedpkg - specfile_path: rpm/skopeo.spec - skopeo-centos: - pkg_tool: centpkg - specfile_path: rpm/skopeo.spec - skopeo-eln: - specfile_path: rpm/skopeo.spec +specfile_path: skopeo.spec -srpm_build_deps: - - make +# Disable automatic merging for Copr builds (and subsequent Testing Farm) +merge_pr_in_ci: false jobs: - job: copr_build trigger: pull_request - packages: [skopeo-fedora] - notifications: &copr_build_failure_notification + notifications: &packit_failure_notification failure_comment: - message: "Ephemeral COPR build failed. @containers/packit-build please check." - targets: - - fedora-all-x86_64 - - fedora-all-aarch64 + message: "Packit jobs failed. @containers/packit-build please check." enable_net: true + targets: + - epel-10-x86_64 + - epel-10-aarch64 + actions: + post-upstream-clone: "curl --fail -O https://gitlab.com/redhat/centos-stream/rpms/skopeo/-/raw/c10s/skopeo.spec" - job: copr_build trigger: pull_request - packages: [skopeo-eln] - notifications: *copr_build_failure_notification - targets: - fedora-eln-x86_64: - additional_repos: - - "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/x86_64/" - fedora-eln-aarch64: - additional_repos: - - "https://kojipkgs.fedoraproject.org/repos/eln-build/latest/aarch64/" + notifications: *packit_failure_notification enable_net: true + targets: + - epel-9-x86_64 + - epel-9-aarch64 + actions: + post-upstream-clone: "curl --fail -O https://gitlab.com/redhat/centos-stream/rpms/skopeo/-/raw/c9s/skopeo.spec" - - job: copr_build + - job: tests trigger: pull_request - packages: [skopeo-centos] - notifications: *copr_build_failure_notification + use_internal_tf: true + notifications: *packit_failure_notification targets: - - centos-stream-9-x86_64 - - centos-stream-9-aarch64 - - centos-stream-10-x86_64 - - centos-stream-10-aarch64 - enable_net: true + epel-10-x86_64: + distros: [RHEL-10-Nightly,RHEL-10.0-Nightly] + epel-10-aarch64: + distros: [RHEL-10-Nightly,RHEL-10.0-Nightly] + epel-9-x86_64: + distros: [RHEL-9-Nightly,RHEL-9.6.0-Nightly] + epel-9-aarch64: + distros: [RHEL-9-Nightly,RHEL-9.6.0-Nightly] + tmt_plan: "/plans/system" + identifier: "rpm" - # Run on commit to main branch - - job: copr_build - trigger: commit - packages: [skopeo-fedora] - notifications: - failure_comment: - message: "podman-next COPR build failed. @containers/packit-build please check." - branch: main - owner: rhcontainerbot - project: podman-next - enable_net: true - - # Sync to Fedora - - job: propose_downstream - trigger: release - packages: [skopeo-fedora] - update_release: false - dist_git_branches: &fedora_targets - - fedora-all - - # Sync to CentOS Stream - - job: propose_downstream - trigger: release - packages: [skopeo-centos] - update_release: false - dist_git_branches: - - c10s - - # Fedora Koji build - - job: koji_build - trigger: commit - packages: [skopeo-fedora] - sidetag_group: podman-releases - # Dependents are not rpm dependencies, but the package whose bodhi update - # should include this package. - # Ref: https://packit.dev/docs/fedora-releases-guide/releasing-multiple-packages - dependents: - - podman - dist_git_branches: *fedora_targets + - job: tests + trigger: pull_request + use_internal_tf: true + notifications: *packit_failure_notification + skip_build: true + targets: + epel-10-x86_64: + distros: [RHEL-10-Nightly,RHEL-10.0-Nightly] + epel-9-x86_64: + distros: [RHEL-9-Nightly,RHEL-9.6.0-Nightly] + tmt_plan: "/plans/no-rpm" + identifier: "no-rpm" diff --git a/plans/no-rpm.fmf b/plans/no-rpm.fmf new file mode 100644 index 00000000..ecce0ea8 --- /dev/null +++ b/plans/no-rpm.fmf @@ -0,0 +1,25 @@ +prepare: + - name: dependencies + how: install + package: [ golang, go-md2man, gpgme-devel, podman-docker ] +# - name: enable-linger +# how: shell +# script: loginctl enable-linger $(whoami) + +discover: + keep-git-metadata: true + how: shell + tests: + - name: /validate + test: > + make && + make tools && + make BUILDTAGS="exclude_graphdriver_btrfs" validate-local && + make validate-docs + - name: /integration + test: make test-integration + - name: /unit + test: make test-unit-local + +execute: + how: tmt diff --git a/plans/system.fmf b/plans/system.fmf new file mode 100644 index 00000000..4d54c84d --- /dev/null +++ b/plans/system.fmf @@ -0,0 +1,13 @@ +discover: + how: fmf + filter: 'tag:system' +execute: + how: tmt +prepare: + - how: shell + script: | + BATS_VERSION=1.12.0 + curl -L https://github.com/bats-core/bats-core/archive/refs/tags/v"$BATS_VERSION".tar.gz | tar -xz + cd bats-core-"$BATS_VERSION" + ./install.sh /usr + order: 10 diff --git a/rpm/skopeo.spec b/rpm/skopeo.spec deleted file mode 100644 index 0c23ce25..00000000 --- a/rpm/skopeo.spec +++ /dev/null @@ -1,170 +0,0 @@ -%global with_debug 1 - -%if 0%{?with_debug} -%global _find_debuginfo_dwz_opts %{nil} -%global _dwz_low_mem_die_limit 0 -%else -%global debug_package %{nil} -%endif - -%global gomodulesmode GO111MODULE=on - -# No btrfs on RHEL -%if %{defined fedora} -%define build_with_btrfs 1 -%endif - -%if %{defined rhel} -%define fips 1 -%endif - -# Only used in official koji builds -# Copr builds set a separate epoch for all environments -%if %{defined fedora} -%define conditional_epoch 1 -%else -%define conditional_epoch 2 -%endif - -Name: skopeo -%if %{defined copr_username} -Epoch: 102 -%else -Epoch: %{conditional_epoch} -%endif -# DO NOT TOUCH the Version string! -# The TRUE source of this specfile is: -# https://github.com/containers/skopeo/blob/main/rpm/skopeo.spec -# If that's what you're reading, Version must be 0, and will be updated by Packit for -# copr and koji builds. -# If you're reading this on dist-git, the version is automatically filled in by Packit. -Version: 0 -# The `AND` needs to be uppercase in the License for SPDX compatibility -License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 -Release: %autorelease -%if %{defined golang_arches_future} -ExclusiveArch: %{golang_arches_future} -%else -ExclusiveArch: aarch64 ppc64le s390x x86_64 -%endif -Summary: Inspect container images and repositories on registries -URL: https://github.com/containers/%{name} -# Tarball fetched from upstream -Source0: %{url}/archive/v%{version}.tar.gz -BuildRequires: %{_bindir}/go-md2man -%if %{defined build_with_btrfs} -BuildRequires: btrfs-progs-devel -%endif -BuildRequires: git-core -BuildRequires: golang -%if !%{defined gobuild} -BuildRequires: go-rpm-macros -%endif -BuildRequires: gpgme-devel -BuildRequires: libassuan-devel -BuildRequires: ostree-devel -BuildRequires: glib2-devel -BuildRequires: make -BuildRequires: shadow-utils-subid-devel -Requires: containers-common >= 4:1-21 - -%description -Command line utility to inspect images and repositories directly on Docker -registries without the need to pull them - -%package tests -Summary: Tests for %{name} - -Requires: %{name} = %{epoch}:%{version}-%{release} -%if %{defined fedora} -Requires: bats -Requires: fakeroot -%endif -Requires: gnupg -Requires: jq -Requires: golang -Requires: podman -Requires: crun -Requires: httpd-tools -Requires: openssl -Requires: squashfs-tools - -%description tests -%{summary} - -This package contains system tests for %{name} - -%prep -%autosetup -Sgit %{name}-%{version} -# The %%install stage should not rebuild anything but only install what's -# built in the %%build stage. So, remove any dependency on build targets. -sed -i 's/^install-binary: bin\/%{name}.*/install-binary:/' Makefile -sed -i 's/^completions: bin\/%{name}.*/completions:/' Makefile -sed -i 's/^install-docs: docs.*/install-docs:/' Makefile - -%build -%set_build_flags -export CGO_CFLAGS=$CFLAGS - -# These extra flags present in $CFLAGS have been skipped for now as they break the build -CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g') -CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-Wp,D_GLIBCXX_ASSERTIONS//g') -CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g') - -%ifarch x86_64 -export CGO_CFLAGS="$CGO_CFLAGS -m64 -mtune=generic -fcf-protection=full" -%endif - -BASEBUILDTAGS="$(hack/libsubid_tag.sh)" -%if %{defined build_with_btrfs} -export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_tag.sh) $(hack/btrfs_installed_tag.sh)" -%else -export BUILDTAGS="$BASEBUILDTAGS btrfs_noversion exclude_graphdriver_btrfs" -%endif - -%if %{defined fips} -export BUILDTAGS="$BUILDTAGS libtrust_openssl" -%endif - -# unset LDFLAGS earlier set from set_build_flags -LDFLAGS='' - -%gobuild -o bin/%{name} ./cmd/%{name} -%{__make} docs - -%install -make \ - DESTDIR=%{buildroot} \ - PREFIX=%{_prefix} \ - install-binary install-docs install-completions - -# system tests -install -d -p %{buildroot}/%{_datadir}/%{name}/test/system -cp -pav systemtest/* %{buildroot}/%{_datadir}/%{name}/test/system/ - -#define license tag if not already defined -%{!?_licensedir:%global license %doc} - -# Include this to silence rpmlint. -# Especially annoying if you use syntastic vim plugin. -%check - -%files -%license LICENSE -%doc README.md -%{_bindir}/%{name} -%{_mandir}/man1/%{name}* -%dir %{_datadir}/bash-completion -%dir %{_datadir}/bash-completion/completions -%{_datadir}/bash-completion/completions/%{name} -%dir %{_datadir}/fish/vendor_completions.d -%{_datadir}/fish/vendor_completions.d/%{name}.fish -%dir %{_datadir}/zsh/site-functions -%{_datadir}/zsh/site-functions/_%{name} - -%files tests -%license LICENSE vendor/modules.txt -%{_datadir}/%{name}/test - -%changelog -%autochangelog diff --git a/systemtest/tmt/main.fmf b/systemtest/tmt/main.fmf new file mode 100644 index 00000000..6e2b5033 --- /dev/null +++ b/systemtest/tmt/main.fmf @@ -0,0 +1,10 @@ +require: + - skopeo-tests + +environment: + SKOPEO_BINARY: /usr/bin/skopeo + +summary: System test +test: bash ./test.sh +duration: 60m +tag: [ system ] diff --git a/systemtest/tmt/test.sh b/systemtest/tmt/test.sh new file mode 100644 index 00000000..30a1b1f9 --- /dev/null +++ b/systemtest/tmt/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -exo pipefail + +uname -r + +rpm -q \ + containers-common \ + skopeo \ + skopeo-tests \ + +bats /usr/share/skopeo/test/system