From 7f14705e90f9ed0684e2bcb92551406ac746f4da Mon Sep 17 00:00:00 2001 From: Cyrill Troxler Date: Wed, 17 Jul 2024 13:02:01 +0200 Subject: [PATCH] feat: add experimental ruby-heroku language --- create/application.go | 5 ++++- get/all_test.go | 2 +- go.mod | 2 +- go.sum | 2 ++ update/application.go | 2 +- update/application_test.go | 7 +++++-- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/create/application.go b/create/application.go index 6dc2a2a..d78513e 100644 --- a/create/application.go +++ b/create/application.go @@ -45,7 +45,7 @@ type applicationCmd struct { GitInformationServiceURL string `help:"URL of the git information service." default:"https://git-info.deplo.io" env:"GIT_INFORMATION_SERVICE_URL" hidden:""` SkipRepoAccessCheck bool `help:"Skip the git repository access check" default:"false"` Debug bool `help:"Enable debug messages" default:"false"` - Language string `help:"Language specifies which language your app is. If left empty, deploio will detect the language automatically. ${enum}" enum:"ruby,php,python,golang,nodejs,static," default:""` + Language string `help:"${app_language_help} Possible values: ${enum}" enum:"ruby,php,python,golang,nodejs,static,ruby-heroku," default:""` } type gitConfig struct { @@ -569,5 +569,8 @@ func ApplicationKongVars() (kong.Vars, error) { result["app_default_deploy_job_timeout"] = "5m" result["app_default_deploy_job_retries"] = "3" + result["app_language_help"] = "Language specifies which language your app is. " + + "If left empty, deploio will detect the language automatically. " + + "Note that *-heroku languages are experimental and may be removed in future releases." return result, nil } diff --git a/get/all_test.go b/get/all_test.go index 4a98bcb..9a4b93e 100644 --- a/get/all_test.go +++ b/get/all_test.go @@ -57,7 +57,7 @@ dev pear Release apps.nine.ch objects: []client.Object{testApplication("banana", "dev"), testRelease("pear", "dev")}, outputFormat: yamlOut, projectName: "dev", - output: "apiVersion: apps.nine.ch/v1alpha1\nkind: Application\nmetadata:\n name: banana\n namespace: dev\nspec:\n forProvider:\n buildEnv: null\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n git:\n revision: \"\"\n subPath: \"\"\n url: \"\"\nstatus:\n atProvider:\n defaultURLs: null\n---\napiVersion: apps.nine.ch/v1alpha1\ncreationTimestampNano: 0\nkind: Release\nmetadata:\n name: pear\n namespace: dev\nspec:\n forProvider:\n build:\n name: \"\"\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n defaultHosts: null\n image: {}\nstatus:\n atProvider: {}\n", + output: "apiVersion: apps.nine.ch/v1alpha1\nkind: Application\nmetadata:\n name: banana\n namespace: dev\nspec:\n forProvider:\n buildEnv: null\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n dockerfileBuild:\n enabled: false\n git:\n revision: \"\"\n subPath: \"\"\n url: \"\"\nstatus:\n atProvider:\n defaultURLs: null\n---\napiVersion: apps.nine.ch/v1alpha1\ncreationTimestampNano: 0\nkind: Release\nmetadata:\n name: pear\n namespace: dev\nspec:\n forProvider:\n build:\n name: \"\"\n config:\n env: null\n port: null\n replicas: null\n size: \"\"\n defaultHosts: null\n image: {}\nstatus:\n atProvider: {}\n", }, "all projects, full format": { projects: test.Projects(organization, "dev", "staging", "prod"), diff --git a/go.mod b/go.mod index 83aa653..ac601f2 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/moby/moby v26.0.0+incompatible github.com/moby/term v0.5.0 - github.com/ninech/apis v0.0.0-20240604065453-1a4b503198d6 + github.com/ninech/apis v0.0.0-20240717081804-d2a5202fde72 github.com/posener/complete v1.2.3 github.com/prometheus/common v0.52.2 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 7414d00..a4463ec 100644 --- a/go.sum +++ b/go.sum @@ -591,6 +591,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/ninech/apis v0.0.0-20240604065453-1a4b503198d6 h1:pLpF8VsnBVqovY3wGxU8LQO8scEn32Lsc9zoqRY3jbs= github.com/ninech/apis v0.0.0-20240604065453-1a4b503198d6/go.mod h1:6lFCwHqvcTFZvJ6zY0rxaPIoKc0CX9sHhtH/nyo/5is= +github.com/ninech/apis v0.0.0-20240717081804-d2a5202fde72 h1:K0GFWZERwXe35L7SZpHRja8PmufQ3L121rmINRioZ+I= +github.com/ninech/apis v0.0.0-20240717081804-d2a5202fde72/go.mod h1:6lFCwHqvcTFZvJ6zY0rxaPIoKc0CX9sHhtH/nyo/5is= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= diff --git a/update/application.go b/update/application.go index da66fe8..9d499e8 100644 --- a/update/application.go +++ b/update/application.go @@ -37,7 +37,7 @@ type applicationCmd struct { GitInformationServiceURL string `help:"URL of the git information service." default:"https://git-info.deplo.io" env:"GIT_INFORMATION_SERVICE_URL" hidden:""` SkipRepoAccessCheck bool `help:"Skip the git repository access check" default:"false"` Debug bool `help:"Enable debug messages" default:"false"` - Language *string `help:"Language specifies which language your app is. If left empty, deploio will detect the language automatically. ${enum}" enum:"ruby,php,python,golang,nodejs,static," default:""` + Language *string `help:"${app_language_help} Possible values: ${enum}" enum:"ruby,php,python,golang,nodejs,static,ruby-heroku," default:""` } type gitConfig struct { diff --git a/update/application_test.go b/update/application_test.go index f7bf9bf..722cbfe 100644 --- a/update/application_test.go +++ b/update/application_test.go @@ -10,6 +10,7 @@ import ( apps "github.com/ninech/apis/apps/v1alpha1" "github.com/ninech/nctl/api" "github.com/ninech/nctl/api/util" + "github.com/ninech/nctl/create" "github.com/ninech/nctl/internal/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -523,7 +524,9 @@ func TestApplication(t *testing.T) { // want to test it in case this ever changes in future kong versions. func TestApplicationFlags(t *testing.T) { nilFlags := &applicationCmd{} - _, err := kong.Must(nilFlags).Parse([]string{`testname`}) + vars, err := create.ApplicationKongVars() + require.NoError(t, err) + _, err = kong.Must(nilFlags, vars).Parse([]string{`testname`}) require.NoError(t, err) assert.Nil(t, nilFlags.Hosts) @@ -531,7 +534,7 @@ func TestApplicationFlags(t *testing.T) { assert.Nil(t, nilFlags.BuildEnv) emptyFlags := &applicationCmd{} - _, err = kong.Must(emptyFlags).Parse([]string{`testname`, `--hosts=""`, `--env=`, `--build-env=`}) + _, err = kong.Must(emptyFlags, vars).Parse([]string{`testname`, `--hosts=""`, `--env=`, `--build-env=`}) require.NoError(t, err) assert.NotNil(t, emptyFlags.Hosts)