Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deb/rpm packages #129

Merged
merged 12 commits into from
Sep 11, 2018
Merged

Add deb/rpm packages #129

merged 12 commits into from
Sep 11, 2018

Conversation

nickatsegment
Copy link
Contributor

@nickatsegment nickatsegment commented Sep 6, 2018

  • Build deb/rpm packages in dist job, using nfpm
  • Split Makefile in to Makefile (simple; mostly aimed at users who want to build it themselves), Makefile.release (complex; aimed at CI/devs) and Makefile.tools (one-off installation tasks)
  • Add test job/recipe
  • Publish prerelease tags (e.g. v2.1.0-anythingwithadash) as github prereleases (mostly for testing this process)
  • Publish binaries, packages, and sha256sum to a Github release
  • Publish packages to PackageCloud

Ended up refactoring a lot of the Makefile and fixing circle in general. I had to use a fair few GNU Make tricks to get it to work in the end; maybe that's crazy

Testing deb

$ docker run -it -v `pwd`:/tmp debian sh
# cd /tmp
# dpkg -i chamber_v2.1.0-prerelease-test-dev_amd64.deb
dpkg: warning: parsing file '/var/lib/dpkg/tmp.ci/control' near line 12 package 'chamber':
 missing maintainer
Selecting previously unselected package chamber.
(Reading database ... 6498 files and directories currently installed.)
Preparing to unpack chamber_v2.1.0-prerelease-test-dev_amd64.deb ...
Unpacking chamber (2.1.0-prerelease-test-dev) ...
Setting up chamber (2.1.0-prerelease-test-dev) ...
# chamber version
chamber v2.1.0-prerelease-test-dev

Testing rpm

$ docker run -it -v `pwd`:/tmp fedora sh
sh-4.4# cd /tmp
sh-4.4# rpm -i chamber_v2.1.0-prerelease-test-dev_amd64.rpm
sh-4.4# chamber version
chamber v2.1.0-prerelease-test-dev

Testing tags

Testing Packagecloud releases

Installing via apt on debian

$ docker run -it debian sh -c 'apt update -q && apt install -yq curl && curl -s https://packagecloud.io/install/repositories/segment/chamber-prerelease/script.deb.sh | bash >/dev/null 2>&1 && apt install -yq chamber && chamber version'
...
Get:1 https://packagecloud.io/segment/chamber-prerelease/debian stretch/main amd64 chamber amd64 2.1.0-prerelease-test3 [4896 kB]
Fetched 4896 kB in 1s (4246 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package chamber.
(Reading database ... 7291 files and directories currently installed.)
Preparing to unpack .../chamber_2.1.0-prerelease-test3_amd64.deb ...
Unpacking chamber (2.1.0-prerelease-test3) ...
Setting up chamber (2.1.0-prerelease-test3) ...
chamber v2.1.0-prerelease-test3

Installing via yum on fedora

$ docker run -it fedora sh -c 'curl -s https://packagecloud.io/install/repositories/segment/chamber-prerelease/script.rpm.sh | bash && yum install -y chamber && chamber version'
Detected operating system as fedora/28.
Checking for curl...
Detected curl...
Downloading repository file: https://packagecloud.io/install/repositories/segment/chamber-prerelease/config_file.repo?os=fedora&dist=28&source=script
done.
Installing pygpgme to verify GPG signatures...
Fedora 28 - x86_64 - Updates                                                                                                                        13 MB/s |  24 MB     00:01
Fedora 28 - x86_64                                                                                                                                  16 MB/s |  60 MB     00:03
Importing GPG key 0x06C8B876:
 Userid     : "https://packagecloud.io/segment/chamber-prerelease (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>"
 Fingerprint: 2965 CB52 8B88 897F EEE5 6625 90F4 AD12 06C8 B876
 From       : https://packagecloud.io/segment/chamber-prerelease/gpgkey
segment_chamber-prerelease-source                                                                                                                  781  B/s | 296  B     00:00
...

Total download size: 4.6 M
Installed size: 17 M
Downloading Packages:
chamber-2.1.0_prerelease_test4-1.x86_64.rpm                                                                                                        8.2 MB/s | 4.6 MB     00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                              8.1 MB/s | 4.6 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                           1/1
  Running scriptlet: chamber-2.1.0_prerelease_test4-1.x86_64                                                                                                                   1/1
  Installing       : chamber-2.1.0_prerelease_test4-1.x86_64                                                                                                                   1/1
  Running scriptlet: chamber-2.1.0_prerelease_test4-1.x86_64                                                                                                                   1/1
  Verifying        : chamber-2.1.0_prerelease_test4-1.x86_64                                                                                                                   1/1

Installed:
  chamber.x86_64 2.1.0_prerelease_test4-1

Complete!
chamber v2.1.0-prerelease-test4

@nickatsegment nickatsegment force-pushed the add-deb-rpm-packages branch 2 times, most recently from 39d8713 to f4bc09b Compare September 6, 2018 04:45
@nickatsegment nickatsegment force-pushed the add-deb-rpm-packages branch 2 times, most recently from a0da4c9 to c233c14 Compare September 10, 2018 23:47
Copy link
Contributor

@systemizer systemizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming you get the publish working (seems to be close), this LGTM

Doing package releases for multiple distributions is an inherently hairy problem. The additional structure in the makefiles makes it readable for engineers. I bet we can even adopt these tools pretty easiyl too.

@nickatsegment nickatsegment merged commit b8363c1 into master Sep 11, 2018
@nickatsegment
Copy link
Contributor Author

After merging, I tested a real-ish prerelease tag and it works :) https://circleci.com/gh/segmentio/chamber/257

nickatsegment added a commit to segmentio/aws-okta that referenced this pull request Sep 11, 2018
* Add deb/rpm package building and publishing

Basically copied segmentio/chamber#129

* split linux dist/publish
@alberts alberts deleted the add-deb-rpm-packages branch February 14, 2019 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants