From 3e1970e7303fc47971176099ff46d3a304fe5168 Mon Sep 17 00:00:00 2001 From: "Zachary J. Rollyson" Date: Thu, 26 Dec 2024 12:06:38 -0500 Subject: [PATCH 1/5] feat: structure as CLI tool, with `drive` subcmd for each stage Also includes some long command descriptions that are mostly lifted from GitLabs Custom executor documentation. --- runner/cf-driver-go/cmd/drive/cleanup.go | 37 +++++++++++++ runner/cf-driver-go/cmd/drive/config.go | 22 ++++++++ runner/cf-driver-go/cmd/drive/drive.go | 50 ++++++++++++++++++ runner/cf-driver-go/cmd/drive/prepare.go | 34 ++++++++++++ runner/cf-driver-go/cmd/drive/run.go | 61 +++++++++++++++++++++ runner/cf-driver-go/cmd/root.go | 30 +++++++++++ runner/cf-driver-go/go.mod | 27 ++++++++-- runner/cf-driver-go/go.sum | 67 ++++++++++++++++++++++-- runner/cf-driver-go/main.go | 16 +----- runner/cf-driver-go/main_test.go | 21 -------- 10 files changed, 324 insertions(+), 41 deletions(-) create mode 100644 runner/cf-driver-go/cmd/drive/cleanup.go create mode 100644 runner/cf-driver-go/cmd/drive/config.go create mode 100644 runner/cf-driver-go/cmd/drive/drive.go create mode 100644 runner/cf-driver-go/cmd/drive/prepare.go create mode 100644 runner/cf-driver-go/cmd/drive/run.go create mode 100644 runner/cf-driver-go/cmd/root.go delete mode 100644 runner/cf-driver-go/main_test.go diff --git a/runner/cf-driver-go/cmd/drive/cleanup.go b/runner/cf-driver-go/cmd/drive/cleanup.go new file mode 100644 index 0000000..428eea0 --- /dev/null +++ b/runner/cf-driver-go/cmd/drive/cleanup.go @@ -0,0 +1,37 @@ +package drive + +import ( + "log" + + "github.com/spf13/cobra" +) + +var cleanupCmd = &cobra.Command{ + Use: "cleanup", + Short: "Cleans up resources, containers, etc. at job completion", + Long: `The Cleanup stage is executed by "cleanup_exec". + +This final stage is executed even if one of the previous stages failed. +The main goal for this stage is to clean up any of the environments that +might have been set up. For example, turning off VMs or deleting +containers. + +The result of cleanup_exec does not affect job statuses. For example, a +job will be marked as successful even if the following occurs: + + Both prepare_exec and run_exec are successful. + cleanup_exec fails. + +The user can set cleanup_exec_timeout if they want to set some kind of +deadline of how long GitLab Runner should wait to clean up the +environment before terminating the process. + +The STDOUT of this executable will be printed to GitLab Runner logs at a +DEBUG level. The STDERR will be printed to the logs at a WARN level. + +Read more in GitLab's documentation: +https://docs.gitlab.com/runner/executors/custom.html#cleanup`, + Run: func(cmd *cobra.Command, args []string) { + log.Println("cleaning up...") + }, +} diff --git a/runner/cf-driver-go/cmd/drive/config.go b/runner/cf-driver-go/cmd/drive/config.go new file mode 100644 index 0000000..f89c83e --- /dev/null +++ b/runner/cf-driver-go/cmd/drive/config.go @@ -0,0 +1,22 @@ +package drive + +import ( + "log" + + "github.com/spf13/cobra" +) + +var configCmd = &cobra.Command{ + Use: "config", + Short: "Configure various jobs settings before they run", + Long: `The Config stage is executed by "config_exec". + +Sometimes you might want to set some settings during execution time. For +example, setting a build directory depending on the project ID. + +For a detailed list of settings that can be configured, read more at: +https://docs.gitlab.com/runner/executors/custom.html#config.`, + Run: func(cmd *cobra.Command, args []string) { + log.Println("configuring...") + }, +} diff --git a/runner/cf-driver-go/cmd/drive/drive.go b/runner/cf-driver-go/cmd/drive/drive.go new file mode 100644 index 0000000..1b715ac --- /dev/null +++ b/runner/cf-driver-go/cmd/drive/drive.go @@ -0,0 +1,50 @@ +package drive + +import ( + "github.com/spf13/cobra" +) + +func init() { + cobra.EnableCommandSorting = false + DriveCmd.AddCommand(configCmd, prepareCmd, runCmd, cleanupCmd) +} + +var DriveCmd = &cobra.Command{ + Use: "drive", + Short: "Drive stages requested by gitlab-runner's executor", + Long: `Drive holds subcommands to run each of executor's stages. + +The Custom executor provides the stages for you to configure some +details of the job, prepare and clean up the environment and run the job +script within it. Each stage is responsible for specific things and has +different things to keep in mind. + +Each stage executed by the Custom executor is executed at the time a +builtin GitLab Runner executor would execute them. + +For each step that will be executed, specific environment variables are +exposed to the executable, which can be used to get information about the +specific Job that is running. All stages will have the following +environment variables available to them: + + - Standard CI/CD environment variables, including predefined variables. + - All environment variables provided by the Custom executor Runner host + system. + - All services and their available settings. Exposed in JSON format as + CUSTOM_ENV_CI_JOB_SERVICES. + +Both CI/CD environment variables and predefined variables are prefixed +with CUSTOM_ENV_ to prevent conflicts with system environment variables. +For example, CI_BUILDS_DIR will be available as CUSTOM_ENV_CI_BUILDS_DIR. + +The stages run in the following sequence: + + 1. config_exec + 2. prepare_exec + 3. run_exec + 4. cleanup_exec + +Read more in GitLab's documentation: +https://docs.gitlab.com/runner/executors/custom.html#stages + `, +} diff --git a/runner/cf-driver-go/cmd/drive/prepare.go b/runner/cf-driver-go/cmd/drive/prepare.go new file mode 100644 index 0000000..c917188 --- /dev/null +++ b/runner/cf-driver-go/cmd/drive/prepare.go @@ -0,0 +1,34 @@ +package drive + +import ( + "log" + + "github.com/spf13/cobra" +) + +var prepareCmd = &cobra.Command{ + Use: "prepare", + Short: "Prepare for jobs by starting containers, services, etc.", + Long: `The Prepare stage is executed by "prepare_exec". + +At this point, GitLab Runner knows everything about the job (where and +how it’s going to run). The only thing left is for the environment to be +set up so the job can run. Prepare will execute the steps necessary to +create that environment. + +This is responsible for setting up the environment (for example, +creating the virtual machine or container, services or anything else). +After this is done, we expect that the environment is ready to run the +job. + +This stage is executed only once in a job execution. + +The STDOUT and STDERR returned from this executable will print to the +job log. + +Read more in GitLab's documentation: +https://docs.gitlab.com/runner/executors/custom.html#prepare`, + Run: func(cmd *cobra.Command, args []string) { + log.Println("preparing...") + }, +} diff --git a/runner/cf-driver-go/cmd/drive/run.go b/runner/cf-driver-go/cmd/drive/run.go new file mode 100644 index 0000000..073991d --- /dev/null +++ b/runner/cf-driver-go/cmd/drive/run.go @@ -0,0 +1,61 @@ +package drive + +import ( + "log" + + "github.com/spf13/cobra" +) + +var runCmd = &cobra.Command{ + Use: "run", + Short: "Executes substages (e.g., cache download) and job steps", + Long: `The Run stage is executed by "run_exec". + +The STDOUT and STDERR returned from this executable will print to the job +log. + +Unlike the other stages, the run_exec stage is executed multiple times, +since it’s split into sub stages listed below in sequential order: + + prepare_script + get_sources + restore_cache + download_artifacts + step_* + build_script + step_* + after_script + archive_cache OR archive_cache_on_failure + upload_artifacts_on_success OR upload_artifacts_on_failure + cleanup_file_variables + +In GitLab Runner 14.0 and later, build_script will be replaced with +step_script. For more information, see this issue. + +For each stage mentioned above, the run_exec executable will be executed +with (1) the path to the script that GitLab Runner creates for the Custom +executor to run, and (2) the name of the stage. + +This executable should be responsible for executing the scripts that are +specified in the first argument. They contain all the scripts any GitLab +Runner executor would run normally to clone, download artifacts, run +user scripts and all the other steps described below. The scripts can be +of the following shells: + + Bash + PowerShell Desktop + PowerShell Core + Batch (deprecated) + +We generate the script using the shell configured by shell inside of +[[runners]]. If none is provided the defaults for the OS platform are used. + +The table below is a detailed explanation of what each script does and +what the main goal of that script is. + +Read more in GitLab's documentation: +https://docs.gitlab.com/runner/executors/custom.html#run`, + Run: func(cmd *cobra.Command, args []string) { + log.Println("running...") + }, +} diff --git a/runner/cf-driver-go/cmd/root.go b/runner/cf-driver-go/cmd/root.go new file mode 100644 index 0000000..0b1b209 --- /dev/null +++ b/runner/cf-driver-go/cmd/root.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "fmt" + "os" + + "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver/cmd/drive" + + "github.com/spf13/cobra" +) + +func init() { + rootCmd.AddCommand(drive.DriveCmd) +} + +var rootCmd = &cobra.Command{ + Use: "cfd", + Short: "CloudFoundry Driver", + Long: `This is CloudFoundry Driver for the GitLab Custom executor. + +The gitlab-runner service should run cfd with it's "drive" subcommands, +e.g., "cfd drive prepare".`, +} + +func Execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} diff --git a/runner/cf-driver-go/go.mod b/runner/cf-driver-go/go.mod index bb6b4f1..601fbf8 100644 --- a/runner/cf-driver-go/go.mod +++ b/runner/cf-driver-go/go.mod @@ -5,17 +5,38 @@ go 1.23 require ( github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9 github.com/google/go-cmp v0.6.0 - github.com/joho/godotenv v1.5.1 + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 ) require ( github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/joho/godotenv v1.5.1 + github.com/magiconair/properties v1.8.7 // indirect github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.9.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/runner/cf-driver-go/go.sum b/runner/cf-driver-go/go.sum index a99c489..748cf02 100644 --- a/runner/cf-driver-go/go.sum +++ b/runner/cf-driver-go/go.sum @@ -2,30 +2,91 @@ github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9 h1:HK3+nJEPgwlhc5H74aw/V4m github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9/go.mod h1:eUjFfpsU3lRv388wKlXMmkQfsJ9pveUHZEia7AoBCPY= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 h1:YFh+sjyJTMQSYjKwM4dFKhJPJC/wfo98tPUc17HdoYw= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11/go.mod h1:Ah2dBMoxZEqk118as2T4u4fjfXarE0pPnMJaArZQZsI= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/runner/cf-driver-go/main.go b/runner/cf-driver-go/main.go index 0c7f0aa..f3afe35 100644 --- a/runner/cf-driver-go/main.go +++ b/runner/cf-driver-go/main.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver/cg" + "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver/cmd" "github.com/joho/godotenv" ) @@ -25,17 +25,5 @@ func main() { panic("error loading .env file") } - cgClient, err := cg.New(&cg.GoCFClientAdapter{}, nil) - if err != nil { - panic(err) - } - - apps, err := cgClient.GetApps() - if err != nil { - panic(err) - } - - for _, app := range apps { - log.Printf("Application %s is %s\n", app.Name, app.State) - } + cmd.Execute() } diff --git a/runner/cf-driver-go/main_test.go b/runner/cf-driver-go/main_test.go deleted file mode 100644 index b0a6641..0000000 --- a/runner/cf-driver-go/main_test.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build !integration - -package main - -import ( - "fmt" - "testing" -) - -func Test_main(t *testing.T) { - t.Skip("Test_main is just for experiments right now") - - tests := []struct{ name string }{{name: "run main"}} - - for _, tt := range tests { - fmt.Println(tt.name) - t.Run(tt.name, func(t *testing.T) { - main() - }) - } -} From 84147ab16ef632eba0a92b17b4c80c90713e9428 Mon Sep 17 00:00:00 2001 From: "Zachary J. Rollyson" Date: Thu, 26 Dec 2024 12:12:55 -0500 Subject: [PATCH 2/5] chore: should have run `tidy` --- runner/cf-driver-go/go.mod | 23 ++++--------------- runner/cf-driver-go/go.sum | 47 ++------------------------------------ 2 files changed, 7 insertions(+), 63 deletions(-) diff --git a/runner/cf-driver-go/go.mod b/runner/cf-driver-go/go.mod index 601fbf8..d4a79e7 100644 --- a/runner/cf-driver-go/go.mod +++ b/runner/cf-driver-go/go.mod @@ -6,37 +6,24 @@ require ( github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9 github.com/google/go-cmp v0.6.0 github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 +) + +require ( + github.com/kr/pretty v0.3.1 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect ) require ( github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab // indirect - github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/joho/godotenv v1.5.1 - github.com/magiconair/properties v1.8.7 // indirect github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.9.0 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/runner/cf-driver-go/go.sum b/runner/cf-driver-go/go.sum index 748cf02..b25180c 100644 --- a/runner/cf-driver-go/go.sum +++ b/runner/cf-driver-go/go.sum @@ -3,20 +3,14 @@ github.com/cloudfoundry/go-cfclient/v3 v3.0.0-alpha.9/go.mod h1:eUjFfpsU3lRv388w github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= @@ -25,68 +19,31 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 h1:YFh+sjyJTMQSYjKwM4dFKhJPJC/wfo98tPUc17HdoYw= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11/go.mod h1:Ah2dBMoxZEqk118as2T4u4fjfXarE0pPnMJaArZQZsI= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 221d737da09b9270919de03fa6e59c4ef1edb349 Mon Sep 17 00:00:00 2001 From: "Zachary J. Rollyson" Date: Fri, 27 Dec 2024 09:25:20 -0500 Subject: [PATCH 3/5] chore: trigger pr workflow From 324fcc5cfb8f86b7a71a3519caa67b1f24332aec Mon Sep 17 00:00:00 2001 From: "Zachary J. Rollyson" Date: Fri, 27 Dec 2024 10:03:29 -0500 Subject: [PATCH 4/5] refactor: rename cf-driver to cfd --- runner/{cf-driver-go => cfd}/.gitignore | 0 runner/{cf-driver-go => cfd}/.vscode/launch.json | 0 runner/{cf-driver-go => cfd}/Makefile | 0 runner/{cf-driver-go => cfd}/README.md | 0 runner/{cf-driver-go => cfd}/cg/cf_adapter.go | 0 runner/{cf-driver-go => cfd}/cg/cg.go | 0 runner/{cf-driver-go => cfd}/cg/cg_integration_test.go | 2 +- runner/{cf-driver-go => cfd}/cg/cg_test.go | 0 runner/{cf-driver-go => cfd}/cg/creds.go | 0 runner/{cf-driver-go => cfd}/cg/creds_test.go | 0 runner/{cf-driver-go => cfd}/cg/testdata/.cg_creds.sample | 0 runner/{cf-driver-go => cfd}/cmd/drive/cleanup.go | 0 runner/{cf-driver-go => cfd}/cmd/drive/config.go | 0 runner/{cf-driver-go => cfd}/cmd/drive/drive.go | 0 runner/{cf-driver-go => cfd}/cmd/drive/prepare.go | 0 runner/{cf-driver-go => cfd}/cmd/drive/run.go | 0 runner/{cf-driver-go => cfd}/cmd/root.go | 2 +- runner/{cf-driver-go => cfd}/go.mod | 2 +- runner/{cf-driver-go => cfd}/go.sum | 0 runner/{cf-driver-go => cfd}/main.go | 2 +- 20 files changed, 4 insertions(+), 4 deletions(-) rename runner/{cf-driver-go => cfd}/.gitignore (100%) rename runner/{cf-driver-go => cfd}/.vscode/launch.json (100%) rename runner/{cf-driver-go => cfd}/Makefile (100%) rename runner/{cf-driver-go => cfd}/README.md (100%) rename runner/{cf-driver-go => cfd}/cg/cf_adapter.go (100%) rename runner/{cf-driver-go => cfd}/cg/cg.go (100%) rename runner/{cf-driver-go => cfd}/cg/cg_integration_test.go (95%) rename runner/{cf-driver-go => cfd}/cg/cg_test.go (100%) rename runner/{cf-driver-go => cfd}/cg/creds.go (100%) rename runner/{cf-driver-go => cfd}/cg/creds_test.go (100%) rename runner/{cf-driver-go => cfd}/cg/testdata/.cg_creds.sample (100%) rename runner/{cf-driver-go => cfd}/cmd/drive/cleanup.go (100%) rename runner/{cf-driver-go => cfd}/cmd/drive/config.go (100%) rename runner/{cf-driver-go => cfd}/cmd/drive/drive.go (100%) rename runner/{cf-driver-go => cfd}/cmd/drive/prepare.go (100%) rename runner/{cf-driver-go => cfd}/cmd/drive/run.go (100%) rename runner/{cf-driver-go => cfd}/cmd/root.go (86%) rename runner/{cf-driver-go => cfd}/go.mod (93%) rename runner/{cf-driver-go => cfd}/go.sum (100%) rename runner/{cf-driver-go => cfd}/main.go (83%) diff --git a/runner/cf-driver-go/.gitignore b/runner/cfd/.gitignore similarity index 100% rename from runner/cf-driver-go/.gitignore rename to runner/cfd/.gitignore diff --git a/runner/cf-driver-go/.vscode/launch.json b/runner/cfd/.vscode/launch.json similarity index 100% rename from runner/cf-driver-go/.vscode/launch.json rename to runner/cfd/.vscode/launch.json diff --git a/runner/cf-driver-go/Makefile b/runner/cfd/Makefile similarity index 100% rename from runner/cf-driver-go/Makefile rename to runner/cfd/Makefile diff --git a/runner/cf-driver-go/README.md b/runner/cfd/README.md similarity index 100% rename from runner/cf-driver-go/README.md rename to runner/cfd/README.md diff --git a/runner/cf-driver-go/cg/cf_adapter.go b/runner/cfd/cg/cf_adapter.go similarity index 100% rename from runner/cf-driver-go/cg/cf_adapter.go rename to runner/cfd/cg/cf_adapter.go diff --git a/runner/cf-driver-go/cg/cg.go b/runner/cfd/cg/cg.go similarity index 100% rename from runner/cf-driver-go/cg/cg.go rename to runner/cfd/cg/cg.go diff --git a/runner/cf-driver-go/cg/cg_integration_test.go b/runner/cfd/cg/cg_integration_test.go similarity index 95% rename from runner/cf-driver-go/cg/cg_integration_test.go rename to runner/cfd/cg/cg_integration_test.go index 699e230..722ba85 100644 --- a/runner/cf-driver-go/cg/cg_integration_test.go +++ b/runner/cfd/cg/cg_integration_test.go @@ -8,7 +8,7 @@ import ( "os" "testing" - "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver/cg" + "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cfd/cg" "github.com/google/go-cmp/cmp" ) diff --git a/runner/cf-driver-go/cg/cg_test.go b/runner/cfd/cg/cg_test.go similarity index 100% rename from runner/cf-driver-go/cg/cg_test.go rename to runner/cfd/cg/cg_test.go diff --git a/runner/cf-driver-go/cg/creds.go b/runner/cfd/cg/creds.go similarity index 100% rename from runner/cf-driver-go/cg/creds.go rename to runner/cfd/cg/creds.go diff --git a/runner/cf-driver-go/cg/creds_test.go b/runner/cfd/cg/creds_test.go similarity index 100% rename from runner/cf-driver-go/cg/creds_test.go rename to runner/cfd/cg/creds_test.go diff --git a/runner/cf-driver-go/cg/testdata/.cg_creds.sample b/runner/cfd/cg/testdata/.cg_creds.sample similarity index 100% rename from runner/cf-driver-go/cg/testdata/.cg_creds.sample rename to runner/cfd/cg/testdata/.cg_creds.sample diff --git a/runner/cf-driver-go/cmd/drive/cleanup.go b/runner/cfd/cmd/drive/cleanup.go similarity index 100% rename from runner/cf-driver-go/cmd/drive/cleanup.go rename to runner/cfd/cmd/drive/cleanup.go diff --git a/runner/cf-driver-go/cmd/drive/config.go b/runner/cfd/cmd/drive/config.go similarity index 100% rename from runner/cf-driver-go/cmd/drive/config.go rename to runner/cfd/cmd/drive/config.go diff --git a/runner/cf-driver-go/cmd/drive/drive.go b/runner/cfd/cmd/drive/drive.go similarity index 100% rename from runner/cf-driver-go/cmd/drive/drive.go rename to runner/cfd/cmd/drive/drive.go diff --git a/runner/cf-driver-go/cmd/drive/prepare.go b/runner/cfd/cmd/drive/prepare.go similarity index 100% rename from runner/cf-driver-go/cmd/drive/prepare.go rename to runner/cfd/cmd/drive/prepare.go diff --git a/runner/cf-driver-go/cmd/drive/run.go b/runner/cfd/cmd/drive/run.go similarity index 100% rename from runner/cf-driver-go/cmd/drive/run.go rename to runner/cfd/cmd/drive/run.go diff --git a/runner/cf-driver-go/cmd/root.go b/runner/cfd/cmd/root.go similarity index 86% rename from runner/cf-driver-go/cmd/root.go rename to runner/cfd/cmd/root.go index 0b1b209..c535dc9 100644 --- a/runner/cf-driver-go/cmd/root.go +++ b/runner/cfd/cmd/root.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver/cmd/drive" + "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cfd/cmd/drive" "github.com/spf13/cobra" ) diff --git a/runner/cf-driver-go/go.mod b/runner/cfd/go.mod similarity index 93% rename from runner/cf-driver-go/go.mod rename to runner/cfd/go.mod index d4a79e7..92b6d46 100644 --- a/runner/cf-driver-go/go.mod +++ b/runner/cfd/go.mod @@ -1,4 +1,4 @@ -module github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver +module github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cfd go 1.23 diff --git a/runner/cf-driver-go/go.sum b/runner/cfd/go.sum similarity index 100% rename from runner/cf-driver-go/go.sum rename to runner/cfd/go.sum diff --git a/runner/cf-driver-go/main.go b/runner/cfd/main.go similarity index 83% rename from runner/cf-driver-go/main.go rename to runner/cfd/main.go index f3afe35..9d780f7 100644 --- a/runner/cf-driver-go/main.go +++ b/runner/cfd/main.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cf-driver/cmd" + "github.com/GSA-TTS/gitlab-runner-cloudgov/runner/cfd/cmd" "github.com/joho/godotenv" ) From f55c55bbf63c91a61a07cbeb7f3fcf987d87bc4b Mon Sep 17 00:00:00 2001 From: "Zachary J. Rollyson" Date: Fri, 27 Dec 2024 10:23:40 -0500 Subject: [PATCH 5/5] fix: forgot to update path in GH action --- .github/workflows/cf-driver-go.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cf-driver-go.yml b/.github/workflows/cf-driver-go.yml index 1a147f2..197020a 100644 --- a/.github/workflows/cf-driver-go.yml +++ b/.github/workflows/cf-driver-go.yml @@ -7,7 +7,7 @@ on: [pull_request] defaults: run: - working-directory: runner/cf-driver-go + working-directory: runner/cfd jobs: build: @@ -18,8 +18,8 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: runner/cf-driver-go/go.mod - cache-dependency-path: runner/cf-driver-go/go.sum + go-version-file: runner/cfd/go.mod + cache-dependency-path: runner/cfd/go.sum - name: Install dependencies run: go get .