diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5645a4..cf9b275 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,13 +8,13 @@ jobs: pack: [go, node, php, python, ruby] steps: - name: Checkout - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5 with: - go-version: 1.18 + go-version: 1.22 - name: Test run: go test -v -run /${{ matrix.pack }} -timeout=20m ./pack/... release: @@ -23,22 +23,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5 with: - go-version: 1.18 + go-version: 1.22 - name: Generate Token id: generate-token - uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c # pin@v1 + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # pin@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # pin@v3 + uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # pin@v6 with: - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 2a680f4..93e8836 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,4 @@ +version: 2 before: hooks: - go mod download @@ -21,16 +22,16 @@ archives: files: - none* brews: - - tap: + - repository: owner: lade-io name: homebrew-tap - folder: Formula + directory: Formula homepage: https://github.com/lade-io/jet description: Convert source code into Docker images checksum: name_template: 'checksums.txt' snapshot: - name_template: "{{ .Tag }}-next" + version_template: "{{ .Tag }}-next" changelog: sort: asc filters: diff --git a/cmd/usage.go b/cmd/usage.go index 6405e42..fe3094e 100644 --- a/cmd/usage.go +++ b/cmd/usage.go @@ -16,10 +16,16 @@ Aliases: {{.NameAndAliases}}{{end}}{{if .HasExample}} Examples: -{{.Example}}{{end}}{{if .HasAvailableSubCommands}} +{{.Example}}{{end}}{{if .HasAvailableSubCommands}}{{$cmds := .Commands}}{{if eq (len .Groups) 0}} -Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} - {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} +Commands:{{range $cmds}}{{if (or .IsAvailableCommand (eq .Name "help"))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{else}}{{range $group := .Groups}} + +{{.Title}}{{range $cmds}}{{if (and (eq .GroupID $group.ID) (or .IsAvailableCommand (eq .Name "help")))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if not .AllChildCommandsHaveGroup}} + +Additional Commands:{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCommand (eq .Name "help")))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} Options: {{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} diff --git a/go.mod b/go.mod index 5751027..2e55841 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/bmatcuk/doublestar v1.3.4 github.com/cloudingcity/gomod v1.0.1 github.com/docker/distribution v2.8.1+incompatible + github.com/docker/docker v20.10.7+incompatible github.com/docker/libcompose v0.4.1-0.20181019154650-213509acef0f github.com/google/go-github/v45 v45.2.0 github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc @@ -31,7 +32,6 @@ require ( github.com/containerd/continuity v0.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v20.10.7+incompatible // indirect - github.com/docker/docker v20.10.7+incompatible // indirect github.com/docker/docker-credential-helpers v0.6.3 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect diff --git a/pack/base.go b/pack/base.go index e69ecdd..bee45a6 100644 --- a/pack/base.go +++ b/pack/base.go @@ -12,11 +12,16 @@ import ( "regexp" "text/template" + "github.com/docker/docker/api" "github.com/docker/libcompose/docker/builder" "github.com/docker/libcompose/docker/client" "github.com/docker/libcompose/logger" ) +var ( + ErrNoBuildpack = errors.New("No known buildpacks support this app") +) + type Pack interface { Detect() bool Metadata() *Metadata @@ -97,7 +102,7 @@ func Detect(workDir string) (pack *Buildpack, err error) { } if len(detected) < 1 { - return nil, errors.New("No known buildpacks support this app") + return nil, ErrNoBuildpack } pack = detected[0] @@ -129,6 +134,7 @@ func (b *Buildpack) BuildImage(name string) (string, error) { return "", err } + os.Setenv("DOCKER_API_VERSION", api.DefaultVersion) imageClient, err := client.Create(client.Options{}) if err != nil { return "", err diff --git a/pack/ruby.go b/pack/ruby.go index d27a28a..e70d1bc 100644 --- a/pack/ruby.go +++ b/pack/ruby.go @@ -131,6 +131,6 @@ func (r *RubyPack) version() (string, string, string) { } var ( - specRegex = regexp.MustCompile(`^\s+([-\w]+)\s\(([.\d]+)\)`) + specRegex = regexp.MustCompile(`^\s+([\w-]+)\s\(([\w-.]+)\)`) rubyRegex = regexp.MustCompile(`['"]?([a-z_]+)['"]?[:=>\s]*['"]([a-z]*[^a-z]*\w)['"]`) ) diff --git a/testdata/python/miniconda/environment.yml b/testdata/python/miniconda/environment.yml index 3b50549..d20714f 100644 --- a/testdata/python/miniconda/environment.yml +++ b/testdata/python/miniconda/environment.yml @@ -1,5 +1,4 @@ name: pydata_test dependencies: -- python=3.8 -- flask=2.0.2 -- numpy=1.21.2 + - flask + - gunicorn=20.1.0 diff --git a/testdata/python/miniconda/manifest.yml b/testdata/python/miniconda/manifest.yml new file mode 100644 index 0000000..d7d4250 --- /dev/null +++ b/testdata/python/miniconda/manifest.yml @@ -0,0 +1,5 @@ +--- +applications: +- name: conda-app + memory: 1GB + diff --git a/testdata/python/miniconda/server.py b/testdata/python/miniconda/server.py index 1701f96..bef5069 100644 --- a/testdata/python/miniconda/server.py +++ b/testdata/python/miniconda/server.py @@ -1,17 +1,19 @@ -from flask import Flask -import os import importlib +import os import sys -import traceback -MODULE_NAMES = ['numpy'] +from flask import Flask + +app = Flask(__name__) + +port = int(os.getenv('VCAP_APP_PORT', 8080)) + +MODULE_NAMES = ['gunicorn'] modules = {} for m in MODULE_NAMES: modules[m] = importlib.import_module(m) -app = Flask(__name__) - def module_version(module_name): m = modules[module_name] @@ -24,16 +26,18 @@ def module_version(module_name): @app.route('/') def root(): - versions = "
"+("
".join([module_version(m) for m in MODULE_NAMES])) + versions = "
" + ("
".join([module_version(m) for m in MODULE_NAMES])) python_version = "python-version%s" % sys.version r = "

Imports Successful!
" return python_version + versions + r -if __name__ == '__main__': - try: - port = int(os.getenv("PORT", 8080)) - app.run(host='0.0.0.0', port=port, debug=True) - except Exception as e: - print("*** CRASHED!!!") - traceback.print_exc() - raise e + +@app.route("/") +def hello(): + return "Hello, World!" + + +app.debug = True + +if __name__ == "__main__": + app.run(host='0.0.0.0', port=port) diff --git a/testdata/ruby/jruby/Gemfile b/testdata/ruby/jruby/Gemfile index eb4b283..bd6c7ad 100644 --- a/testdata/ruby/jruby/Gemfile +++ b/testdata/ruby/jruby/Gemfile @@ -1,5 +1,7 @@ source 'https://rubygems.org' -ruby '2.6.8', :engine => 'jruby', :engine_version => '9.3.4.0' +ruby '3.1.4', :engine => 'jruby', :engine_version => '9.4.8.0' +gem 'puma', '~> 3' gem 'sinatra' +gem 'webrick' diff --git a/testdata/ruby/jruby/Gemfile.lock b/testdata/ruby/jruby/Gemfile.lock index ab0889d..8046726 100644 --- a/testdata/ruby/jruby/Gemfile.lock +++ b/testdata/ruby/jruby/Gemfile.lock @@ -1,27 +1,31 @@ GEM remote: https://rubygems.org/ specs: - mustermann (1.1.1) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - rack (2.2.3) - rack-protection (2.2.0) + puma (3.12.6-java) + rack (2.2.7) + rack-protection (3.0.6) rack ruby2_keywords (0.0.5) - sinatra (2.2.0) - mustermann (~> 1.0) - rack (~> 2.2) - rack-protection (= 2.2.0) + sinatra (3.0.6) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.6) tilt (~> 2.0) - tilt (2.0.10) + tilt (2.2.0) + webrick (1.8.1) PLATFORMS universal-java-1.8 DEPENDENCIES + puma (~> 3) sinatra + webrick RUBY VERSION - ruby 2.6.8p0 (jruby 9.3.4.0) + ruby 3.1.4p0 (jruby 9.4.3.0) BUNDLED WITH - 2.3.13 + 2.4.14 diff --git a/testdata/ruby/jruby/manifest.yml b/testdata/ruby/jruby/manifest.yml index 8f47fd5..7ab7346 100644 --- a/testdata/ruby/jruby/manifest.yml +++ b/testdata/ruby/jruby/manifest.yml @@ -1,4 +1,3 @@ --- applications: - name: sinatra_jruby_web_app - command: jruby -S bundle exec rackup config.ru -p $PORT diff --git a/testdata/ruby/jruby/vendor/cache/mustermann-1.1.1.gem b/testdata/ruby/jruby/vendor/cache/mustermann-1.1.1.gem deleted file mode 100644 index 5501866..0000000 Binary files a/testdata/ruby/jruby/vendor/cache/mustermann-1.1.1.gem and /dev/null differ diff --git a/testdata/ruby/jruby/vendor/cache/mustermann-3.0.0.gem b/testdata/ruby/jruby/vendor/cache/mustermann-3.0.0.gem new file mode 100644 index 0000000..aa1582b Binary files /dev/null and b/testdata/ruby/jruby/vendor/cache/mustermann-3.0.0.gem differ diff --git a/testdata/ruby/jruby/vendor/cache/rack-2.2.3.gem b/testdata/ruby/jruby/vendor/cache/rack-2.2.3.gem deleted file mode 100644 index 19fa2e9..0000000 Binary files a/testdata/ruby/jruby/vendor/cache/rack-2.2.3.gem and /dev/null differ diff --git a/testdata/ruby/jruby/vendor/cache/rack-2.2.7.gem b/testdata/ruby/jruby/vendor/cache/rack-2.2.7.gem new file mode 100644 index 0000000..57ea2c7 Binary files /dev/null and b/testdata/ruby/jruby/vendor/cache/rack-2.2.7.gem differ diff --git a/testdata/ruby/jruby/vendor/cache/rack-protection-2.2.0.gem b/testdata/ruby/jruby/vendor/cache/rack-protection-2.2.0.gem deleted file mode 100644 index 1e2d08f..0000000 Binary files a/testdata/ruby/jruby/vendor/cache/rack-protection-2.2.0.gem and /dev/null differ diff --git a/testdata/ruby/jruby/vendor/cache/rack-protection-3.0.6.gem b/testdata/ruby/jruby/vendor/cache/rack-protection-3.0.6.gem new file mode 100644 index 0000000..7b563cd Binary files /dev/null and b/testdata/ruby/jruby/vendor/cache/rack-protection-3.0.6.gem differ diff --git a/testdata/ruby/jruby/vendor/cache/sinatra-2.2.0.gem b/testdata/ruby/jruby/vendor/cache/sinatra-2.2.0.gem deleted file mode 100644 index 4114652..0000000 Binary files a/testdata/ruby/jruby/vendor/cache/sinatra-2.2.0.gem and /dev/null differ diff --git a/testdata/ruby/jruby/vendor/cache/sinatra-3.0.6.gem b/testdata/ruby/jruby/vendor/cache/sinatra-3.0.6.gem new file mode 100644 index 0000000..4be7010 Binary files /dev/null and b/testdata/ruby/jruby/vendor/cache/sinatra-3.0.6.gem differ diff --git a/testdata/ruby/jruby/vendor/cache/tilt-2.0.10.gem b/testdata/ruby/jruby/vendor/cache/tilt-2.0.10.gem deleted file mode 100644 index b432e15..0000000 Binary files a/testdata/ruby/jruby/vendor/cache/tilt-2.0.10.gem and /dev/null differ diff --git a/testdata/ruby/jruby/vendor/cache/tilt-2.2.0.gem b/testdata/ruby/jruby/vendor/cache/tilt-2.2.0.gem new file mode 100644 index 0000000..30774e9 Binary files /dev/null and b/testdata/ruby/jruby/vendor/cache/tilt-2.2.0.gem differ diff --git a/testdata/ruby/jruby/vendor/cache/webrick-1.8.1.gem b/testdata/ruby/jruby/vendor/cache/webrick-1.8.1.gem new file mode 100644 index 0000000..ac0894b Binary files /dev/null and b/testdata/ruby/jruby/vendor/cache/webrick-1.8.1.gem differ