Skip to content

Commit

Permalink
Add buildpack error.
Browse files Browse the repository at this point in the history
  • Loading branch information
beornf committed Oct 19, 2024
1 parent 334f922 commit b3b050d
Show file tree
Hide file tree
Showing 23 changed files with 74 additions and 48 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
7 changes: 4 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
before:
hooks:
- go mod download
Expand All @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions cmd/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion pack/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pack/ruby.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)['"]`)
)
5 changes: 2 additions & 3 deletions testdata/python/miniconda/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: pydata_test
dependencies:
- python=3.8
- flask=2.0.2
- numpy=1.21.2
- flask
- gunicorn=20.1.0
5 changes: 5 additions & 0 deletions testdata/python/miniconda/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
applications:
- name: conda-app
memory: 1GB

34 changes: 19 additions & 15 deletions testdata/python/miniconda/server.py
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -24,16 +26,18 @@ def module_version(module_name):

@app.route('/')
def root():
versions = "<br>"+("<br>".join([module_version(m) for m in MODULE_NAMES]))
versions = "<br>" + ("<br>".join([module_version(m) for m in MODULE_NAMES]))
python_version = "python-version%s" % sys.version
r = "<br><br>Imports Successful!<br>"
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)
4 changes: 3 additions & 1 deletion testdata/ruby/jruby/Gemfile
Original file line number Diff line number Diff line change
@@ -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'
24 changes: 14 additions & 10 deletions testdata/ruby/jruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion testdata/ruby/jruby/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
applications:
- name: sinatra_jruby_web_app
command: jruby -S bundle exec rackup config.ru -p $PORT
Binary file not shown.
Binary file not shown.
Binary file removed testdata/ruby/jruby/vendor/cache/rack-2.2.3.gem
Binary file not shown.
Binary file added testdata/ruby/jruby/vendor/cache/rack-2.2.7.gem
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed testdata/ruby/jruby/vendor/cache/sinatra-2.2.0.gem
Binary file not shown.
Binary file not shown.
Binary file removed testdata/ruby/jruby/vendor/cache/tilt-2.0.10.gem
Binary file not shown.
Binary file added testdata/ruby/jruby/vendor/cache/tilt-2.2.0.gem
Binary file not shown.
Binary file not shown.

0 comments on commit b3b050d

Please sign in to comment.