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 22, 2024
1 parent 334f922 commit d121c77
Show file tree
Hide file tree
Showing 321 changed files with 20,129 additions and 34,995 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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module github.com/lade-io/jet

go 1.18
go 1.22.0

require (
github.com/ake-persson/mapslice-json v0.0.0-20210720081907-22c8edf57807
github.com/aquasecurity/go-version v0.0.0-20210121072130-637058cfe492
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 Expand Up @@ -74,7 +74,7 @@ require (
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect
google.golang.org/grpc v1.38.0 // indirect
Expand All @@ -84,6 +84,6 @@ require (

replace (
github.com/Nvveen/Gotty => github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd
github.com/aquasecurity/go-version => github.com/beornf/goversion v0.0.0-20230212045613-eac47a9c209d
github.com/aquasecurity/go-version => github.com/beornf/goversion v0.0.0-20241022080423-63c828623ebb
github.com/docker/libcompose => github.com/beornf/libcompose v0.4.1-0.20210215180846-a59802c0f07c
)
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/beornf/goversion v0.0.0-20230212045613-eac47a9c209d h1:BP1Y4UYwcLtyBognUrZRBqsY+/34Xs1eg/wqidQzpaM=
github.com/beornf/goversion v0.0.0-20230212045613-eac47a9c209d/go.mod h1:9Beu8XsUNNfzml7WBf3QmyPToP1wm1Gj/Vc5UJKqTzU=
github.com/beornf/goversion v0.0.0-20241022080423-63c828623ebb h1:t+hPoxEOJMXTUx/O9PE0cgyBBuEUIGIZrrbXSc2CV5c=
github.com/beornf/goversion v0.0.0-20241022080423-63c828623ebb/go.mod h1:1cPOp4BaQZ1G2F5fnw4dFz6pkOyXJI9KTuak8ghIl3U=
github.com/beornf/libcompose v0.4.1-0.20210215180846-a59802c0f07c h1:tDYcjKncxyn3Cj0UDnDxjy8oH0RruaMQSxXE5s7suzI=
github.com/beornf/libcompose v0.4.1-0.20210215180846-a59802c0f07c/go.mod h1:9+ps1KKtVtRUdpVxJldssQItPf/S5t5bO0zh4A0Hy5g=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
Expand Down Expand Up @@ -573,6 +573,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-containerregistry v0.0.0-20191010200024-a3d713f9b7f8/go.mod h1:KyKXa9ciM8+lgMXwOVsXi7UxGrsf9mM61Mzs+xKUrKE=
github.com/google/go-containerregistry v0.1.2/go.mod h1:GPivBPgdAyd2SU+vf6EpsgOtWDuPqjW0hJZt4rNdTZ4=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
Expand Down Expand Up @@ -1089,7 +1090,6 @@ github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
Expand Down Expand Up @@ -1398,6 +1398,7 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -1480,8 +1481,9 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
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
6 changes: 2 additions & 4 deletions pack/php.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ func (p *PhpPack) Command() (string, error) {

func (p *PhpPack) Version() (string, error) {
requires := p.requires()
version := phpPipe.Split(requires["php"], -1)
return strings.Join(version, "||"), nil
return requires["php"], nil
}

func (p *PhpPack) extensions() ([]string, []string, []string, []string, []string) {
Expand Down Expand Up @@ -162,7 +161,7 @@ func composerRequire(name string, pkgs map[string]mapslice.MapSlice, requires ma
if version, ok := requires[key]; !ok {
requires[key] = value
composerRequire(key, pkgs, requires)
} else if !strings.Contains(version, value) {
} else if !strings.Contains(version, value) && !strings.Contains(value, "|") {
requires[key] = version + "," + value
}
}
Expand Down Expand Up @@ -242,7 +241,6 @@ func (p *PhpPack) webroot() string {

var (
phpLayout = regexp.MustCompile(`^require.*index\.php`)
phpPipe = regexp.MustCompile(`\|+`)
)

const (
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)['"]`)
)
20 changes: 20 additions & 0 deletions testdata/php/symfony/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/shyim/devcontainers-features/symfony-cli:0": {},
"ghcr.io/shyim/devcontainers-features/php:0": {
"version": "8.1"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
}
},
"updateContentCommand": {
"composer install": ["composer", "install"],
"yarn": ["yarn"]
},
"postAttachCommand": {
"server": "symfony server:start",
"yarn": ["yarn", "watch"]
}
}
10 changes: 6 additions & 4 deletions testdata/php/symfony/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=prod
APP_ENV=dev
APP_SECRET=2ca64f8d83b9e89f5f19d672841d6bb8
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/mailer ###
# MAILER_DSN=smtp://localhost
# MAILER_DSN=null://null
###< symfony/mailer ###
1 change: 1 addition & 0 deletions testdata/php/symfony/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database_test.sqlite
24 changes: 24 additions & 0 deletions testdata/php/symfony/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/public/build/fonts/glyphicons-*
/public/build/images/glyphicons-*

.php-version

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> symfony/webpack-encore-bundle ###
/node_modules/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
'phpdoc_order' => true,
'strict_comparison' => true,
'strict_param' => true,
'blank_line_between_import_groups' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/var/.php_cs.cache')
->setCacheFile(__DIR__.'/var/.php-cs-fixer.cache')
;
Loading

0 comments on commit d121c77

Please sign in to comment.