puppetlabs / bolt-vanagon

Apache License 2.0
2 stars 30 forks source link

(BOLT-1317) Update build_defaults for shipping gem #109

Closed donoghuc closed 5 years ago

donoghuc commented 5 years ago

This commit adds some metadata for the ship_gem rake task to be able to ship a staged gem from builds.delivery.pl.net to rubygems.

donoghuc commented 5 years ago

@mwaggett I confirmed that the build defaults in https://github.com/puppetlabs/bolt/tree/master/ext appear to be required, do you think these should be added there as well? Or only in this project?

Can you think of a way to there a way to test this? Given that you can easily push the gem artifact manually if it doesn't ship with the ship_gem rake task I would be OK with just seeing if it works next week if it will be a pain to test.

mwaggett commented 5 years ago

@donoghuc Should what be added where as well?

Here's how I would test:

  1. Build a gem from this branch and ship it to builds.delivery - this is needed so that the task to retrieve the gem will know what sha/directory to look in.
  2. bundle install
  3. bundle exec rake pl:jenkins:retrieve
  4. bundle exec rake pl:ship_gem Since you're not an owner of the bolt gem on rubygems.org, this shouldn't actually ship the gem, but you'll be able to see if the pl:ship_gem task actually does anything.
donoghuc commented 5 years ago

Cool, will try your method. Was wondering if the metadata added here should also be added to the metadata in bolt https://github.com/puppetlabs/bolt/tree/master/ext

mwaggett commented 5 years ago

@donoghuc It's already there..? or you mean the gem_name: bolt part? You shouldn't need that if you're building with gem build and not packaging tasks.

donoghuc commented 5 years ago

@molly I'm concerned that the project being called puppet-bolt is messing with the rake tasks ability to work with git. It seems like we need project to be called puppet-bolt so it finds the right artifacts on builds. Is there a way to specify git project separately?

cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ git diff
diff --git a/configs/components/bolt.json b/configs/components/bolt.json
index 91e6fa4..af5f0b5 100644
--- a/configs/components/bolt.json
+++ b/configs/components/bolt.json
@@ -1 +1 @@
-{"url":"git://github.com/puppetlabs/bolt.git","ref":"44a379c064060483dbfd189dd3f2b0e18201daeb"}
+{"url":"git://github.com/puppetlabs/bolt.git","ref":"refs/tags/1.24.0"}
cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ bundle exec rake pl:jenkins:retrieve
Skipping platform_data collection, but don't worry about it.

    DEPRECATED, 29-Jul-2014: 'gpg_name' has been replaced with 'gpg_key'.
                   Please update this field in your build_defaults.yaml
touch /home/cas/.packaging
Cloning into '/tmp/pkgk0fFU9'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 879 (delta 0), reused 1 (delta 0), pack-reused 877
Receiving objects: 100% (879/879), 149.32 KiB | 408.00 KiB/s, done.
Resolving deltas: 100% (221/221), done.
Switched to a new branch 'dev'
error: pathspec 'puppet-bolt' did not match any file(s) known to git
Unable to load build_defaults from branch 'puppet-bolt' in 'https://github.com/puppetlabs/build-data.git'. Skipping.
rm -rf /tmp/pkgk0fFU9
mkdir -p pkg
Executing /usr/bin/wget --quiet --recursive --no-parent --no-host-directories --level=0 --cut-dirs=3 --directory-prefix=pkg --reject='index*' http://builds.delivery.puppetlabs.net/puppet-bolt/a7413d9b93f4f2707971103d282674a2096dd832/artifacts/ . . .
rake aborted!
Uh oh, looks like we didn't find anything in pkg when attempting to retrieve from http://builds.delivery.puppetlabs.net/puppet-bolt/a7413d9b93f4f2707971103d282674a2096dd832/artifacts!
/home/cas/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/cas/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => pl:jenkins:retrieve
(See full trace by running task with --trace)
cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ bundle exec rake pl:ship_gem
Skipping platform_data collection, but don't worry about it.

    DEPRECATED, 29-Jul-2014: 'gpg_name' has been replaced with 'gpg_key'.
                   Please update this field in your build_defaults.yaml
touch /home/cas/.packaging
Cloning into '/tmp/pkg6oWF2x'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 879 (delta 0), reused 1 (delta 0), pack-reused 877
Receiving objects: 100% (879/879), 149.32 KiB | 447.00 KiB/s, done.
Resolving deltas: 100% (221/221), done.
Switched to a new branch 'dev'
error: pathspec 'puppet-bolt' did not match any file(s) known to git
Unable to load build_defaults from branch 'puppet-bolt' in 'https://github.com/puppetlabs/build-data.git'. Skipping.
rm -rf /tmp/pkg6oWF2x
Not shipping development gem using odd_even strategy for the sake of your users

or is this expected?

mwaggett commented 5 years ago

@donoghuc The

error: pathspec 'puppet-bolt' did not match any file(s) known to git
Unable to load build_defaults from branch 'puppet-bolt' in 'https://github.com/puppetlabs/build-data.git'. Skipping.

error is expected and not actually an error.

This is the real error:

Uh oh, looks like we didn't find anything in pkg when attempting to retrieve from http://builds.delivery.puppetlabs.net/puppet-bolt/a7413d9b93f4f2707971103d282674a2096dd832/artifacts!

Looks like you didn't build anything from that sha.

donoghuc commented 5 years ago

ohhhh derp, that sha is this commit, I thought it would look at the ref in bolt.json. I'm an idiot. Also i cant trick it by checking out that tag

cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ git status
HEAD detached at 1.24.0
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   ext/build_defaults.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    docker/

no changes added to commit (use "git add" and/or "git commit -a")
cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ git diff
diff --git a/ext/build_defaults.yaml b/ext/build_defaults.yaml
index 065a255..8fcd9eb 100644
--- a/ext/build_defaults.yaml
+++ b/ext/build_defaults.yaml
@@ -1,5 +1,7 @@
 ---
 project: 'puppet-bolt'
+gem_name: 'bolt'
+build_gem: TRUE
 gpg_name: 'info@puppetlabs.com'
 gpg_key: '7F438280EF8D349F'
 sign_tar: FALSE
cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ bundle exec rake pl:jenkins:retrieve
Skipping platform_data collection, but don't worry about it.

    DEPRECATED, 29-Jul-2014: 'gpg_name' has been replaced with 'gpg_key'.
                   Please update this field in your build_defaults.yaml
touch /home/cas/.packaging
Cloning into '/tmp/pkgHCINb4'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
Receiving objects: 100% (879/879), 149.31 KiB | 631.00 KiB/s, done.
remote: Total 879 (delta 0), reused 1 (delta 0), pack-reused 877
Resolving deltas: 100% (221/221), done.
Switched to a new branch 'dev'
error: pathspec 'puppet-bolt' did not match any file(s) known to git
Unable to load build_defaults from branch 'puppet-bolt' in 'https://github.com/puppetlabs/build-data.git'. Skipping.
rm -rf /tmp/pkgHCINb4
mkdir -p pkg
Executing /usr/bin/wget --quiet --recursive --no-parent --no-host-directories --level=0 --cut-dirs=3 --directory-prefix=pkg --reject='index*' http://builds.delivery.puppetlabs.net/puppet-bolt/1.24.0-dirty/artifacts/ . . .
rake aborted!
Uh oh, looks like we didn't find anything in pkg when attempting to retrieve from http://builds.delivery.puppetlabs.net/puppet-bolt/1.24.0-dirty/artifacts!
/home/cas/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/cas/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => pl:jenkins:retrieve
(See full trace by running task with --trace)
cas@cas-ThinkPad-T460p:~/working_dir/bolt-vanagon$ bundle exec rake pl:ship_gem
Skipping platform_data collection, but don't worry about it.

    DEPRECATED, 29-Jul-2014: 'gpg_name' has been replaced with 'gpg_key'.
                   Please update this field in your build_defaults.yaml
touch /home/cas/.packaging
Cloning into '/tmp/pkgvNOD6H'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 879 (delta 0), reused 1 (delta 0), pack-reused 877
Receiving objects: 100% (879/879), 149.32 KiB | 574.00 KiB/s, done.
Resolving deltas: 100% (221/221), done.
Switched to a new branch 'dev'
error: pathspec 'puppet-bolt' did not match any file(s) known to git
Unable to load build_defaults from branch 'puppet-bolt' in 'https://github.com/puppetlabs/build-data.git'. Skipping.
rm -rf /tmp/pkgvNOD6H
Not shipping development gem using odd_even strategy for the sake of your users.

lol 1.24.0-dirty, I see now how this works. i think we should just merge this