Commit graph

127 commits

Author SHA1 Message Date
Matthias Loibl
20988370cc
Fix generate README script 2020-01-08 11:39:44 +01:00
Matthias Loibl
f1f1723381
Prepare a v0.2.0 release 2020-01-08 11:20:36 +01:00
sh0rez
376432fadd
feat(cli): version flag (#60)
* feat(cli): version flag

Adds a --version flag to jb. Only available on go versions greater than 1.12

* style: add license headers

* chore(ci): generate only on latest go

* fix: unique step names

* doc: include version in README help text

* fix: rebuild .drone.yml using drone.cli

* fix: remove race condidion from CI
2019-12-14 16:40:30 +01:00
Frederic Branczyk
d7829f6c7e
Merge pull request #59 from metalmatze/go-versions-ci
Test for 3 latest Go versions in CI
2019-11-12 09:30:02 +01:00
Matthias Loibl
442ccc505a
Revert to pkg/errors usage for Go 1.11 & 1.12 2019-11-12 01:41:33 +01:00
Matthias Loibl
f1b13bd42d
Test for 3 latest Go versions in CI 2019-11-10 13:44:10 +01:00
Viktor Erpylev
7b564ae8b5 Add install instructions to README.md (#54) 2019-11-08 15:45:20 +01:00
Hang Xie
013e3937e8 fix: unknown pathspec on tags (#58)
forces to fetch tags from the remote. This was dependent on `git-config` before and led to issues with some users where tags were not be fetched
2019-11-08 15:44:37 +01:00
David Genest
f4417ac665 only write jsonnnet files if we made changes (#56)
Adding a dep, or updating a dependency version makes writes to the
jsonnet files.

We evaluate the changes on each of the files. An empty jsonnetfile.json
does not create a corresponding lockfile, as a missing lockfile is not
different from its previous (non existent).
2019-11-08 15:36:13 +01:00
Frederic Branczyk
7fc7c31856
Merge pull request #44 from sh0rez/rework-install
feat: rework install
2019-10-31 11:15:18 +01:00
sh0rez
db1aae9b08
fix: disable sha256 for local packages 2019-10-30 17:40:08 +01:00
sh0rez
4de4096004
fix: fail on invalid URI 2019-10-29 22:35:59 +01:00
sh0rez
61fd099392
chore(vendor): embedmd 2019-10-29 22:18:22 +01:00
sh0rez
b23411fe58
fix: add sum to integration test 2019-10-29 22:16:59 +01:00
sh0rez
12a8bc9d9d
chore(vendor): github.com/stretchr/testify/require 2019-10-29 22:10:16 +01:00
sh0rez
6e283c5310
test: jsonnetfile marshalling 2019-10-29 22:09:03 +01:00
sh0rez
1caefa556e
refactor: remove dead code 2019-10-29 22:08:31 +01:00
sh0rez
0588b89c07
feat: minor improvements
- allow to install pkg that is already locked
- clean unknown files from vendor
- correctly handle checksums and locked versions (was accidentally ignoring
- these before)
2019-10-29 21:44:49 +01:00
sh0rez
cc1d7ea3b8
feat: sort output of jsonnetfile
To keep the output deterministic, both `jsonnetfile.json` and the lockfile are
now sorted alphabetically by the packages name
2019-10-29 21:44:45 +01:00
sh0rez
ffd43cf94e
fix: ensure in update
moves the update command implementation to the new Ensure function
2019-10-29 21:44:41 +01:00
sh0rez
6e3e7b2fdd
refactor: use a map instead of a slice
Packages are unique anyways so it makes sense to use a map to avoid having
duplicates.

For compatibility reasons custom json (un)marshallers hide this change from the
end user
2019-10-29 21:44:38 +01:00
sh0rez
4b6e2d89e9
feat: check sum after download
To see if we actually got what we expected
2019-10-29 21:44:34 +01:00
sh0rez
36311f1601
feat: rewrite install procedure
rewrites the installation of packages from scratch to solve several issues with
the existing implementation:

- does not need to choose between lockfile and jsonnetfile anymore. The
jsonnetfile what to be installed, while the lockfile also has versions and
checksums of all packages, even nested ones.
- the lockfile is regenerated on every run, preserving the locked values
- downloaded packages are hashed using sha256 to make sure we receive what we
expect. If files on the local disk are modified, they are downloaded again.
2019-10-29 21:44:30 +01:00
sh0rez
71938456ae
refactor: switch to pkg/jsonnetfile
So far, `pkg` and `pkg/jsonnetfile` had overlapping functionality when it came
to choosing and loading jsonnetfiles.

This fully switches to the separate package `pkg/jsonnetfile` that seems to be
created for exactly this purpose
2019-10-29 21:44:27 +01:00
sh0rez
a718f48cd8
refactor: dependency parsing
Refactors the dependency parsing function chain to evaluate the type of the
dependency right in `parseDependency` to make it clearer what is going on while
reading the code. Before, functions were returning if it was a different type,
which was not that clear from `parseDependency`.
2019-10-29 21:44:23 +01:00
Frederic Branczyk
766a0c7fd8
Merge pull request #51 from davidovich/restore-symlinks
restore symlinks from tar archive
2019-10-25 09:50:15 +02:00
david
f3c21baad8 restore symlinks from tar archive
fixes #50
2019-10-24 22:41:13 -04:00
Benoit Gagnon
32baaddaf6
Merge pull request #49 from bgagnon/fix-ref-etag-resolve
Replace ETag SHA1 assumption with an explicit call to git ls-remote
2019-10-24 12:07:55 -04:00
Benoit Gagnon
ed7d84f846 update comments to reflect git install changes
Signed-off-by: Benoit Gagnon <benoit.gagnon@ubisoft.com>
2019-10-24 11:08:24 -04:00
Benoit Gagnon
1915ef519a relax the SHA1 regex to cover SHA1, SHA256 and any other length of SHA
Signed-off-by: Benoit Gagnon <benoit.gagnon@ubisoft.com>
2019-10-24 11:06:36 -04:00
Benoit Gagnon
2bf42f11cd use fmt.Errorf(...) instead of errors.new(fmt.Sprintf(...))
Signed-off-by: Benoit Gagnon <benoit.gagnon@ubisoft.com>
2019-10-24 11:05:54 -04:00
Benoit Gagnon
f09b41c7da
use regexp.MustCompile
Co-Authored-By: David Genest <david.genest@gmail.com>
2019-10-24 10:47:35 -04:00
Benoit Gagnon
a44fae09a0
declare Buffer instead of using NewBuffer
Co-Authored-By: David Genest <david.genest@gmail.com>
2019-10-24 10:46:51 -04:00
Benoit Gagnon
f4b09c811e replace ETag SHA1 assumption with an explicit call to git ls-remote
Not using an undocumented ETag header from the GitHub archive API is
probably for the best. This is slightly slower due to extra round-trip,
but it is still much faster than cloning the repository to resolve the
ref.

Signed-off-by: Benoit Gagnon <benoit.gagnon@ubisoft.com>
2019-10-23 10:52:39 -04:00
Frederic Branczyk
673e9111b1
Merge pull request #42 from metalmatze/local-dependency-check
Check local dependency symlink destition for existence
2019-10-11 09:32:31 +02:00
Matthias Loibl
b21c04091a
Check errors or explicitly ignore 2019-10-10 17:47:41 +02:00
Matthias Loibl
f994e4644e
Fix install integration tests 2019-10-10 17:14:42 +02:00
Matthias Loibl
a2cf8f6412
Update vendor/ after updating to Go 1.13 2019-10-09 15:42:55 +02:00
Matthias Loibl
9a2a8afaeb
Introduce Go 1.13 to use stdlib error wrapping 2019-10-09 15:40:14 +02:00
Matthias Loibl
b1501bbce7
Check local dependency symlink destition for existence 2019-10-09 15:25:53 +02:00
Frederic Branczyk
10e24cb869
Merge pull request #38 from bgagnon/git-clone-optim
Git package install optimizations
2019-09-30 13:47:13 +02:00
Benoit Gagnon
50eac0e70c move the extracted archive into place before exiting Install 2019-09-29 17:24:47 -04:00
Benoit Gagnon
41278d8ef4 undo typo in tarball url format 2019-09-28 11:43:10 -04:00
Benoit Gagnon
741e7f316f fall back to git if github archive download fails for any reason 2019-09-28 11:41:08 -04:00
Benoit Gagnon
2b485512c0 improve github archive download error reporting 2019-09-28 11:40:09 -04:00
Benoit Gagnon
524c820a94 use regex instead of prefix match to detect github remotes
this will allow the optimization to work for both ssh and https
2019-09-28 11:23:15 -04:00
Benoit Gagnon
76d85b1f49 honor header.Mode for directories found in tarballs 2019-09-28 11:04:49 -04:00
Benoit Gagnon
5b12e9c798 additional error checking 2019-09-28 10:57:02 -04:00
Benoit Gagnon
93c18a7d4d motivate the explicit f.Close() 2019-09-28 10:56:47 -04:00
Benoit Gagnon
b597b16173 use filepath.Join instead of string concatenation 2019-09-28 10:32:26 -04:00