Stop hab downloads

Hi,

I have an internet connected machine I’m using to create tar packages for my non internet connected production machines.

Everything goes fine till I run

hab pkg export tar path.to.my.hart

When I do this I see this output:

[root@localhost jirotech]# hab pkg export tar ./results/jirotech-node_exporter-release-0.16-20180829015721-x86_64-linux.hart
Ω Creating build root in /tmp/hab-pkg-export-tar.4Fn1VFCYnHgt
Ω Creating root filesystem
Ω Creating artifact cache symlink
Ω Creating key cache symlink
» Installing core/hab from channel 'stable'
↓ Downloading core/hab/0.61.0/20180815171844
    2.87 MB / 2.87 MB \ [==============================================================================================================================================================================================================================] 100.00 % 51.41 MB/s
☛ Verifying core/hab/0.61.0/20180815171844
✓ Installed core/hab/0.61.0/20180815171844
★ Install of core/hab/0.61.0/20180815171844 complete with 1 new packages installed.
» Installing core/hab-sup from channel 'stable'
↓ Downloading core/hab-sup/0.61.0/20180815173401

I don’t want to upgrade to 0.61.0 - I’m on 0.55.0 and I need to be.

I tried using the URL option to point to a fake BLDR - but this uncovers another bug:

[root@localhost jirotech]# hab pkg export ---url http://localhost tar ./results/jirotech-node_exporter-release-0.16-20180829015721-x86_64-linux.hart
✗✗✗
✗✗✗ Unsupported export format: tar
✗✗✗

I also tried with the HAB_BLDR_URL vairable set, which doesn’t work either (with a not so pretty error):

root@localhost jirotech]# export HAB_BLDR_URL=http://localhost
[root@localhost jirotech]# hab pkg export tar ./results/jirotech-node_exporter-release-0.16-20180829015721-x86_64-linux.hart
Ω Creating build root in /tmp/hab-pkg-export-tar.sQtipmJGvMTL
Ω Creating root filesystem
Ω Creating artifact cache symlink
Ω Creating key cache symlink
» Installing core/hab from channel 'stable'
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DepotClient(HyperError(Io(Error { repr: Os { code: 111, message: "Connection refused" } })))', /checkout/src/libcore/result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Is there any way round this short of ripping out the parts of the tar.gz I don’t want?

Cheers,
james

Ah indeed. So by default, yes when you run an export it’s going to attempt to pull all the latest packages unless otherwise specified (which would include hab and hab-sup) luckily hab pkg export tar has some escape hatches via cli flags. I think the two you’re probably interested in are the following:

         --hab-pkg <HAB_PKG>
            Habitat CLI package identifier (ex: acme/redis) or filepath to a Habitat artifact (ex: /home/acme-redis
            -3.0.7-21120102031201-x86_64-linux.hart) to install (default: core/hab)
        --sup-pkg <HAB_SUP_PKG>
            Supervisor package identifier (ex: core/hab-sup) or filepath to a Habitat artifact (ex: /home/ore-hab-sup
            -0.39.1-20171118011657-x86_64-linux.hart) to install (default: core/hab-sup)

WRT the errors you’re seeing that last error appears to be the right behavior. Effectively if you specify a bldr url that doesnt accept a connection, it should panic and raise the error it did. However, the first error you’re seeing there is definitely not helpful. Would you be able to open an issue on the habitat repo with this information? If not, with your permission, I’m happy to copy what you have here over to GHub. Hope this helps!

Thanks! Any reason these flags aren’t documented?

I’ll try them out today, and also open an issue for that command line problem.

OH SNAP!

They are documented, but only in the new version I was trying not to use.

All sorted now.

[root@localhost jirotech]# hab pkg export  tar ./results/jirotech-node_exporter-release-0.16-20180829031649-x86_64-linux.hart  --hab-pkg /hab/cache/artifacts/core-hab-0.55.0-20180321220925-x86_64-linux.hart --sup-pkg /hab/cache/artifacts/core-hab-sup-0.55.0-20180321222338-x86_64-linux.hart
Ω Creating build root in /tmp/hab-pkg-export-tar.YS7B5Ie4M6yd
Ω Creating root filesystem
Ω Creating artifact cache symlink
Ω Creating key cache symlink
» Installing /hab/cache/artifacts/core-hab-0.55.0-20180321220925-x86_64-linux.hart
☛ Verifying core/hab/0.55.0/20180321220925
✓ Installed core/hab/0.55.0/20180321220925
★ Install of core/hab/0.55.0/20180321220925 complete with 1 new packages installed.
» Installing /hab/cache/artifacts/core-hab-sup-0.55.0-20180321222338-x86_64-linux.hart
☛ Verifying core/hab-sup/0.55.0/20180321222338
☛ Verifying core/busybox-static/1.24.2/20170513215502
☛ Verifying core/bzip2/1.0.6/20170513212938
☛ Verifying core/cacerts/2017.09.20/20171014212239
☛ Verifying core/gcc-libs/5.2.0/20170513212920
☛ Verifying core/glibc/2.22/20170513201042
☛ Verifying core/libarchive/3.3.2/20171018164107
☛ Verifying core/libsodium/1.0.13/20170905223149
☛ Verifying core/linux-headers/4.3/20170513200956
☛ Verifying core/openssl/1.0.2l/20171014213633
☛ Verifying core/xz/5.2.2/20170513214327
☛ Verifying core/zeromq/4.2.2/20171018132502
☛ Verifying core/zlib/1.2.8/20170513201911
✓ Installed core/busybox-static/1.24.2/20170513215502
✓ Installed core/bzip2/1.0.6/20170513212938
✓ Installed core/cacerts/2017.09.20/20171014212239
✓ Installed core/gcc-libs/5.2.0/20170513212920
✓ Installed core/glibc/2.22/20170513201042
✓ Installed core/libarchive/3.3.2/20171018164107
✓ Installed core/libsodium/1.0.13/20170905223149
✓ Installed core/linux-headers/4.3/20170513200956
✓ Installed core/openssl/1.0.2l/20171014213633
✓ Installed core/xz/5.2.2/20170513214327
✓ Installed core/zeromq/4.2.2/20171018132502
✓ Installed core/zlib/1.2.8/20170513201911
✓ Installed core/hab-sup/0.55.0/20180321222338
★ Install of core/hab-sup/0.55.0/20180321222338 complete with 13 new packages installed.
» Installing core/hab-launcher
☁ Determining latest version of core/hab-launcher in the 'stable' channel
☛ Verifying core/hab-launcher/8133/20180810175521
→ Using core/bzip2/1.0.6/20170513212938
→ Using core/cacerts/2017.09.20/20171014212239
→ Using core/gcc-libs/5.2.0/20170513212920
→ Using core/glibc/2.22/20170513201042
→ Using core/libarchive/3.3.2/20171018164107
→ Using core/libsodium/1.0.13/20170905223149
→ Using core/linux-headers/4.3/20170513200956
→ Using core/openssl/1.0.2l/20171014213633
→ Using core/xz/5.2.2/20170513214327
→ Using core/zlib/1.2.8/20170513201911
✓ Installed core/hab-launcher/8133/20180810175521
★ Install of core/hab-launcher/8133/20180810175521 complete with 1 new packages installed.
» Installing core/busybox-static
☁ Determining latest version of core/busybox-static in the 'stable' channel
☛ Verifying core/busybox-static/1.28.1/20180608102729
✓ Installed core/busybox-static/1.28.1/20180608102729
★ Install of core/busybox-static/1.28.1/20180608102729 complete with 1 new packages installed.
» Installing ./results/jirotech-node_exporter-release-0.16-20180829031649-x86_64-linux.hart
☛ Verifying jirotech/node_exporter/release-0.16/20180829031649
✓ Installed jirotech/node_exporter/release-0.16/20180829031649
★ Install of jirotech/node_exporter/release-0.16/20180829031649 complete with 1 new packages installed.
☒ Deleting artifact key symlink
☒ Deleting artifact cache symlink
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidPackageIdent("/hab/cache/artifacts/core-hab-0.55.0-20180321220925-x86_64-linux.hart")', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

:frowning:

I’ll open an issue.

In case anyone else finds this, this works:

hab pkg export  tar ./results/jirotech-node_exporter-release-0.16-20180829031649-x86_64-linux.hart  --hab-pkg core/hab/0.55.0 --sup-pkg core/hab-sup/0.55.0