Skip to content

Commit

Permalink
Merge pull request #157 from TomasTomecek/doc-local-p-s-env
Browse files Browse the repository at this point in the history
faq: document how to reproduce sandbox env locally

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
  • Loading branch information
softwarefactory-project-zuul[bot] committed Sep 1, 2020
2 parents fe59479 + 5dd4808 commit f2399dd
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
49 changes: 49 additions & 0 deletions content/faq/_index.md
Expand Up @@ -149,3 +149,52 @@ you need and us making them available for you.

In the mean time we are solving these requests one by one, so [please reach out
to us](#how-can-i-contact-you).

### A command failed in packit-service: how do I reproduce it locally?

We don't have an end-to-end solution to this, yet.

In the meantime, you can pull our production sandbox image and run the command
inside. As an example, this is how we were debugging build problems with
anaconda:

1. Clone the upstream git repo.

2. Pull the sandbox image:

```
$ docker pull docker.io/usercont/sandcastle:prod
```

3. Launch the container and bind-mount the upstream project inside:

```
$ docker run -ti --rm -v $PWD:/anaconda docker.io/usercont/sandcastle:prod bash
```

4. Run commands of your choice:

```
[root@4af5dbd9c828 /]# cd /anaconda
[root@4af5dbd9c828 anaconda]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
...
```

Our deployment is running in [OpenShift
Online](https://www.openshift.com/products/online/) which is using docker as a
container engine, that's why we are using docker here and not
[podman](https://github.com/containers/podman).
43 changes: 43 additions & 0 deletions docs/faq/index.html
Expand Up @@ -908,6 +908,7 @@ <h3>More</h3>
<li><a href="#after-adding-tests-i-see-error-no-fmf-metadata-found">After adding tests I see error &lsquo;No FMF metadata found.&rsquo;</a></li>
<li><a href="#does-packit-work-with-rpmautospechttpsdocspagureorgfedora-infrarpmautospec">Does packit work with <a href="https://docs.pagure.org/Fedora-Infra.rpmautospec/">rpmautospec</a>?</a></li>
<li><a href="#how-do-i-install-dependencies-for-my-commands-in-packit-service">How do I install dependencies for my commands in packit-service?</a></li>
<li><a href="#a-command-failed-in-packit-service-how-do-i-reproduce-it-locally">A command failed in packit-service: how do I reproduce it locally?</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -1029,6 +1030,48 @@ <h3 id="how-do-i-install-dependencies-for-my-commands-in-packit-service">How do
you need and us making them available for you.</p>
<p>In the mean time we are solving these requests one by one, so <a href="#how-can-i-contact-you">please reach out
to us</a>.</p>
<h3 id="a-command-failed-in-packit-service-how-do-i-reproduce-it-locally">A command failed in packit-service: how do I reproduce it locally?</h3>
<p>We don&rsquo;t have an end-to-end solution to this, yet.</p>
<p>In the meantime, you can pull our production sandbox image
(<code>docker.io/usercont/sandcastle:prod</code>) and run the command inside. As an
example, this is how we were debugging build problems with anaconda:</p>
<ol>
<li>
<p>Clone the upstream git repo.</p>
</li>
<li>
<p>Pull the sandbox image:</p>
</li>
</ol>
<pre><code>$ docker pull docker.io/usercont/sandcastle:prod
</code></pre><ol start="3">
<li>Launch the container and bind-mount the upstream project inside:</li>
</ol>
<pre><code>$ docker run -ti --rm -v $PWD:/anaconda docker.io/usercont/sandcastle:prod bash
</code></pre><ol start="4">
<li>Run commands of your choice:</li>
</ol>
<pre><code>[root@4af5dbd9c828 /]# cd /anaconda

[root@4af5dbd9c828 anaconda]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
...
</code></pre><p>Our deployment is running in <a href="https://www.openshift.com/products/online/">OpenShift
Online</a> which is using docker as a
container engine, that&rsquo;s why we are using docker here and not
<a href="https://github.com/containers/podman">podman</a>.</p>



Expand Down
2 changes: 1 addition & 1 deletion docs/index.json
Expand Up @@ -221,7 +221,7 @@
"title": "FAQ",
"tags": [],
"description": "",
"content": "Can I use the packit service as soon as I install it into my repository? Thanks for your interest in Packit Service! In order to start using the service you need to be whitelisted, which is an action to be done by us. Once we put you on the whitelist, we\u0026rsquo;ll get in touch with you. We are now on-boarding Fedora contributors (with a Fedora Account System account).\nCan I use packit service for any GitHub repository? Since packit service builds your PRs in Fedora COPR build service, by using Packit-as-a-service, your software needs to comply with COPR rules. If any of these points are violated, we\u0026rsquo;ll remove the builds and may put you on a blacklist so you won\u0026rsquo;t be able to use the service again.\nHow can I contact you? If you encounter a problem while using Packit-as-a-service, please open an upstream issue. In case of any other questions, feel free to contact us:\n freenode #packit user-cont-team@redhat.com Why do I have to maintain .packit.yaml and a spec file upstream? We are working on simplifying the .packit.yaml so it\u0026rsquo;s as small as possible. We will also handle all potentially backward incompatible changes of .packit.yaml. Spec file can be downloaded (see specific question below) from Fedora Pagure instead of having it included in the upstream repository.\nBut what are the benefits? Packit makes it trivial to run your project as part of an OS. It provides feedback to your project at the time when the changes are being developed so you can fix incompatible code when you are working on it, not when it\u0026rsquo;s already released. When you push commits to a pull request, you\u0026rsquo;ll get RPM build and test results right away.\nWhy Fedora? We\u0026rsquo;ve started with Fedora Linux because we work for Red Hat and we ❤ Fedora.\nHow is Packit different from other services? Packit connects the existing services (Copr, Pagure, Koji, Bodhi) together.\nCan we use Packit with Gitlab? Packit service is closely tied to GitHub right now because most of the projects are hosted on GitHub. Let us know if you\u0026rsquo;d like to see Gitlab support.\nHow can I download RPM spec file if it is not part of upstream repository? If you do not want to have the RPM spec file in your upstream repository, you can download it in actions section.\nAdd actions section to your packit.yaml configuration file and download the spec file in a hook post_upstream_clone. Packit service has a limited set of commands available so please use wget or curl.\nThe configuration file with downloading the RPM spec file now looks like this:\nspecfile_path: packit.spec synced_files: - packit.spec - .packit.yaml upstream_package_name: packitos downstream_package_name: packit actions: post-upstream-clone: \u0026quot;wget https://src.fedoraproject.org/rpms/packit/raw/master/f/packit.spec\u0026quot; I have a template of a spec file in my repo: can packit work with it? Yes!\nThe solution is, again, actions and hooks. Just render the spec after the upstream repo is cloned:\nspecfile_path: my-project.spec upstream_package_name: my-project-src downstream_package_name: my-project actions: post-upstream-clone: \u0026quot;make generate-spec\u0026quot; Where the \u0026ldquo;generate-spec\u0026rdquo; make target could look like this:\ngenerate-spec: sed -e 's/@@VERSION@@/$(VERSION)/g' my-project.spec.template \u0026gt;my-project.spec As a practical example, cockpit-podman project is using this functionality.\nCan I use CentOS Stream with packit service? Yes, you can! It\u0026rsquo;s very simple, just add centos-stream-x86_64 as a target for the copr_build job:\njobs: - job: copr_build trigger: pull_request metadata: targets: - centos-stream-x86_64 After adding tests I see error \u0026lsquo;No FMF metadata found.\u0026rsquo; If you encounter this error when running tests via Testing Farm, it means you forgot to initialize the metadata tree with fmf init and include the .fmf directory in the pull request. See Testing Farm documentation for more information.\nDoes packit work with rpmautospec? Good that you ask. It does, packit works with rpmautospec quite nicely.\nBefore you start, please make sure that you follow latest documentation for rpmautospec.\nrpmautospec utilizes two RPM macros:\n autorel — to populate Release autochangelog — to figure out changelog If you want your upstream spec file to also work well when rpmautospec-rpm-macros is not installed, set Release to this:\nRelease: %{?autorel}%{!?autorel:1} This construct uses autorel macro if it\u0026rsquo;s defined, and if it\u0026rsquo;s not, it sets release to 1.\nFor %changelog, you don\u0026rsquo;t need to include the changelog file upstream and you can have it downstream only, which makes sense - changelog is specific to a release.\nHow do I install dependencies for my commands in packit-service? We are running all commands, defined by you, in a sandbox which is locked-down. At the moment we don\u0026rsquo;t have any mechanism for you to define the dependencies you need and us making them available for you.\nIn the mean time we are solving these requests one by one, so please reach out to us.\n"
"content": "Can I use the packit service as soon as I install it into my repository? Thanks for your interest in Packit Service! In order to start using the service you need to be whitelisted, which is an action to be done by us. Once we put you on the whitelist, we\u0026rsquo;ll get in touch with you. We are now on-boarding Fedora contributors (with a Fedora Account System account).\nCan I use packit service for any GitHub repository? Since packit service builds your PRs in Fedora COPR build service, by using Packit-as-a-service, your software needs to comply with COPR rules. If any of these points are violated, we\u0026rsquo;ll remove the builds and may put you on a blacklist so you won\u0026rsquo;t be able to use the service again.\nHow can I contact you? If you encounter a problem while using Packit-as-a-service, please open an upstream issue. In case of any other questions, feel free to contact us:\n freenode #packit user-cont-team@redhat.com Why do I have to maintain .packit.yaml and a spec file upstream? We are working on simplifying the .packit.yaml so it\u0026rsquo;s as small as possible. We will also handle all potentially backward incompatible changes of .packit.yaml. Spec file can be downloaded (see specific question below) from Fedora Pagure instead of having it included in the upstream repository.\nBut what are the benefits? Packit makes it trivial to run your project as part of an OS. It provides feedback to your project at the time when the changes are being developed so you can fix incompatible code when you are working on it, not when it\u0026rsquo;s already released. When you push commits to a pull request, you\u0026rsquo;ll get RPM build and test results right away.\nWhy Fedora? We\u0026rsquo;ve started with Fedora Linux because we work for Red Hat and we ❤ Fedora.\nHow is Packit different from other services? Packit connects the existing services (Copr, Pagure, Koji, Bodhi) together.\nCan we use Packit with Gitlab? Packit service is closely tied to GitHub right now because most of the projects are hosted on GitHub. Let us know if you\u0026rsquo;d like to see Gitlab support.\nHow can I download RPM spec file if it is not part of upstream repository? If you do not want to have the RPM spec file in your upstream repository, you can download it in actions section.\nAdd actions section to your packit.yaml configuration file and download the spec file in a hook post_upstream_clone. Packit service has a limited set of commands available so please use wget or curl.\nThe configuration file with downloading the RPM spec file now looks like this:\nspecfile_path: packit.spec synced_files: - packit.spec - .packit.yaml upstream_package_name: packitos downstream_package_name: packit actions: post-upstream-clone: \u0026quot;wget https://src.fedoraproject.org/rpms/packit/raw/master/f/packit.spec\u0026quot; I have a template of a spec file in my repo: can packit work with it? Yes!\nThe solution is, again, actions and hooks. Just render the spec after the upstream repo is cloned:\nspecfile_path: my-project.spec upstream_package_name: my-project-src downstream_package_name: my-project actions: post-upstream-clone: \u0026quot;make generate-spec\u0026quot; Where the \u0026ldquo;generate-spec\u0026rdquo; make target could look like this:\ngenerate-spec: sed -e 's/@@VERSION@@/$(VERSION)/g' my-project.spec.template \u0026gt;my-project.spec As a practical example, cockpit-podman project is using this functionality.\nCan I use CentOS Stream with packit service? Yes, you can! It\u0026rsquo;s very simple, just add centos-stream-x86_64 as a target for the copr_build job:\njobs: - job: copr_build trigger: pull_request metadata: targets: - centos-stream-x86_64 After adding tests I see error \u0026lsquo;No FMF metadata found.\u0026rsquo; If you encounter this error when running tests via Testing Farm, it means you forgot to initialize the metadata tree with fmf init and include the .fmf directory in the pull request. See Testing Farm documentation for more information.\nDoes packit work with rpmautospec? Good that you ask. It does, packit works with rpmautospec quite nicely.\nBefore you start, please make sure that you follow latest documentation for rpmautospec.\nrpmautospec utilizes two RPM macros:\n autorel — to populate Release autochangelog — to figure out changelog If you want your upstream spec file to also work well when rpmautospec-rpm-macros is not installed, set Release to this:\nRelease: %{?autorel}%{!?autorel:1} This construct uses autorel macro if it\u0026rsquo;s defined, and if it\u0026rsquo;s not, it sets release to 1.\nFor %changelog, you don\u0026rsquo;t need to include the changelog file upstream and you can have it downstream only, which makes sense - changelog is specific to a release.\nHow do I install dependencies for my commands in packit-service? We are running all commands, defined by you, in a sandbox which is locked-down. At the moment we don\u0026rsquo;t have any mechanism for you to define the dependencies you need and us making them available for you.\nIn the mean time we are solving these requests one by one, so please reach out to us.\nA command failed in packit-service: how do I reproduce it locally? We don\u0026rsquo;t have an end-to-end solution to this, yet.\nIn the meantime, you can pull our production sandbox image (docker.io/usercont/sandcastle:prod) and run the command inside. As an example, this is how we were debugging build problems with anaconda:\n Clone the upstream git repo.\n Pull the sandbox image:\n $ docker pull docker.io/usercont/sandcastle:prod Launch the container and bind-mount the upstream project inside: $ docker run -ti --rm -v $PWD:/anaconda docker.io/usercont/sandcastle:prod bash Run commands of your choice: [root@4af5dbd9c828 /]# cd /anaconda [root@4af5dbd9c828 anaconda]# ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether UID '0' is supported by ustar format... yes checking whether GID '0' is supported by ustar format... yes checking how to create a ustar tar archive... gnutar checking whether make supports nested variables... (cached) yes checking whether make supports the include directive... yes (GNU style) checking for gcc... gcc checking whether the C compiler works... yes ... Our deployment is running in OpenShift Online which is using docker as a container engine, that\u0026rsquo;s why we are using docker here and not podman.\n"
},
{
"uri": "https://packit.dev/docs/cli/copr-build/",
Expand Down

0 comments on commit f2399dd

Please sign in to comment.