Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to make resource outputs nullable during diff phase #250

Merged
merged 37 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
abaa325
Add terraform resource. Fix some small things.
Aug 26, 2023
4a3897a
Add terraform resource
Aug 28, 2023
a1d7103
Add log for debugging
Aug 28, 2023
2986362
Add fields to blueprint
Aug 31, 2023
bdacc65
Make config optional
eveld Sep 11, 2023
7f4b735
Fix bugs in start when Docker not available
nicholasjackson Sep 13, 2023
e790dcc
use experimental hclparser
nicholasjackson Sep 13, 2023
0e5df3a
add local ingress for kubernetes
nicholasjackson Aug 21, 2023
d4885a4
Add auto refresh for k8s config, add auto push for k8s clusters
nicholasjackson Aug 22, 2023
caa1b18
implement local services for k8s
nicholasjackson Aug 22, 2023
c7a6342
fix tests
nicholasjackson Aug 22, 2023
679d5b1
Fix output for multiple k8s test
nicholasjackson Aug 22, 2023
18a9f5c
Add datacenter attribute for nomad, fix data_with_permissions
nicholasjackson Aug 24, 2023
c90c371
Add error to data_with_permissions
nicholasjackson Aug 25, 2023
ebfa741
Fix Badges
tdensmore Aug 26, 2023
ee88505
Properly set hostname for docker containers.
apollo13 Aug 27, 2023
aa9c140
Add support for selinux relabeling in volumes.
apollo13 Aug 27, 2023
ec7a4ff
fix nomad example to use correct consul join
nicholasjackson Aug 29, 2023
2461f11
fix assigned address to remove netmask, update nomad example
nicholasjackson Aug 29, 2023
fc92910
enable warnings in hcl config for diff
nicholasjackson Oct 6, 2023
fb63cb3
Run podman functional tests in debug mode
nicholasjackson Sep 15, 2023
a895a95
Add capability to ignore files when taring a list of files or buildin…
nicholasjackson Sep 15, 2023
7989f63
remove nomad and k8s tests from podman, verified locally
nicholasjackson Sep 15, 2023
91f61e2
Update changelog
nicholasjackson Sep 15, 2023
1ca5f12
Update winget package
nicholasjackson Sep 16, 2023
a5b0ba6
Remove dependencies for build
nicholasjackson Sep 16, 2023
7c2ede0
Fix issue in cache when not running, fix winget
nicholasjackson Sep 18, 2023
2eacfa4
fix panic when docker is not running
nicholasjackson Sep 20, 2023
74036b2
Add terraform resource. Fix some small things.
Aug 26, 2023
7a26ead
Add terraform resource
Aug 28, 2023
d62511a
Fix bugs in start when Docker not available
nicholasjackson Sep 13, 2023
7e492f6
use new hcl parser
nicholasjackson Oct 6, 2023
5fc722d
update hclconfig to v0.16.0
nicholasjackson Oct 8, 2023
4a043cb
Fix issues with updated HCL parser
nicholasjackson Oct 18, 2023
eb049a9
Ensure remote is optional
nicholasjackson Oct 19, 2023
5a7fb87
Complete tests for Terraform provider
nicholasjackson Oct 23, 2023
4942e66
Merge branch 'main' into new-resources
nicholasjackson Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_and_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
'./examples/local_exec',
'./examples/remote_exec',
'./examples/certificates',
'./examples/terraform',
]

steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ bin/
dist/
.vscode
.envrc
.terraform
.terraform
.terraform.lock.hcl
7 changes: 6 additions & 1 deletion cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/jumppad-labs/jumppad/cmd/view"
"github.com/jumppad-labs/jumppad/pkg/clients"
"github.com/jumppad-labs/jumppad/pkg/jumppad"
"github.com/jumppad-labs/jumppad/pkg/utils"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -55,7 +56,11 @@ func newDevCmdFunc(variables *[]string, variablesFile, interval *string, ttyFlag
}
}

engine, _, _ = createEngine(v.Logger())
engineClients, _ := clients.GenerateClients(v.Logger())
engine, _, err := createEngine(v.Logger(), engineClients)
if err != nil {
return fmt.Errorf("unable to create engine: %s", err)
}

// create the shipyard and sub folders in the users home directory
utils.CreateFolders()
Expand Down
23 changes: 15 additions & 8 deletions cmd/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"os"

"github.com/jumppad-labs/jumppad/pkg/clients"
"github.com/jumppad-labs/jumppad/pkg/clients/connector"
"github.com/jumppad-labs/jumppad/pkg/utils"
"github.com/spf13/cobra"
Expand All @@ -15,25 +16,31 @@ func newDestroyCmd(cc connector.Connector) *cobra.Command {
Long: "Remove all resources in the current state",
Example: `jumppad down`,
Run: func(cmd *cobra.Command, args []string) {
err := engine.Destroy()
l := createLogger()
engineClients, _ := clients.GenerateClients(l)
engine, _, err := createEngine(l, engineClients)
if err != nil {
l.Error("Unable to create engine", "error", err)
return
}

err = engine.Destroy()
logger := createLogger()

if err != nil {
logger.Error("Unable to destroy stack", "error", err)
l.Error("Unable to destroy stack", "error", err)
return
}

// clean up the data folder
os.RemoveAll(utils.GetDataFolder("", os.ModePerm))

// clean up the library folder
os.RemoveAll(utils.GetLibraryFolder("", os.ModePerm))
// clean up the data folders
os.RemoveAll(utils.DataFolder("", os.ModePerm))
os.RemoveAll(utils.LibraryFolder("", os.ModePerm))

// shutdown ingress when we destroy all resources
if cc.IsRunning() {
err = cc.Stop()
if err != nil {
logger.Error("Unable to destroy stack", "error", err)
logger.Error("Unable to destroy jumppad daemon", "error", err)
}
}
},
Expand Down
16 changes: 12 additions & 4 deletions cmd/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ func newPurgeCmdFunc(dt container.Docker, il images.ImageLog, l logger.Logger) f
bHasError = true
}

hcp := utils.GetBlueprintLocalFolder("")
hcp := utils.BlueprintLocalFolder("")
l.Info("Removing cached blueprints", "path", hcp)
err = os.RemoveAll(hcp)
if err != nil {
l.Error("Unable to remove cached blueprints", "error", err)
bHasError = true
}

bcp := utils.GetHelmLocalFolder("")
bcp := utils.HelmLocalFolder("")
l.Info("Removing cached Helm charts", "path", bcp)
err = os.RemoveAll(bcp)
if err != nil {
Expand All @@ -92,22 +92,30 @@ func newPurgeCmdFunc(dt container.Docker, il images.ImageLog, l logger.Logger) f
}

// delete the releases
rcp := utils.GetReleasesFolder()
rcp := utils.ReleasesFolder()
l.Info("Removing cached releases", "path", rcp)
err = os.RemoveAll(rcp)
if err != nil {
l.Error("Unable to remove cached Releases", "error", err)
bHasError = true
}

dcp := utils.GetDataFolder("", os.ModePerm)
dcp := utils.DataFolder("", os.ModePerm)
l.Info("Removing data folders", "path", dcp)
err = os.RemoveAll(dcp)
if err != nil {
l.Error("Unable to remove data folder", "error", err)
bHasError = true
}

ccp := utils.DataFolder("", os.ModePerm)
l.Info("Removing cache folders", "path", ccp)
err = os.RemoveAll(ccp)
if err != nil {
l.Error("Unable to remove cache folder", "error", err)
bHasError = true
}

cp := path.Join(utils.JumppadHome(), "config")
l.Info("Removing config", "path", cp)
err = os.RemoveAll(cp)
Expand Down
97 changes: 49 additions & 48 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,65 +23,23 @@ var rootCmd = &cobra.Command{
Long: `Jumppad is a tool that helps you create and run development, demo, and tutorial environments`,
}

var engine jumppad.Engine
var l logger.Logger
var engineClients *clients.Clients

var version string // set by build process
var date string // set by build process
var commit string // set by build process

func init() {

var vm gvm.Versions

// setup dependencies
l = createLogger()
engine, engineClients, vm = createEngine(l)

rootCmd.AddCommand(checkCmd)
rootCmd.AddCommand(outputCmd)
rootCmd.AddCommand(newDevCmd())
rootCmd.AddCommand(newEnvCmd(engine))
rootCmd.AddCommand(newRunCmd(engine, engineClients.ContainerTasks, engineClients.Getter, engineClients.HTTP, engineClients.Browser, vm, engineClients.Connector, l))
rootCmd.AddCommand(newTestCmd())
rootCmd.AddCommand(newDestroyCmd(engineClients.Connector))
rootCmd.AddCommand(statusCmd)
rootCmd.AddCommand(newPurgeCmd(engineClients.Docker, engineClients.ImageLog, l))
rootCmd.AddCommand(taintCmd)
rootCmd.AddCommand(newVersionCmd(vm))
rootCmd.AddCommand(uninstallCmd)
rootCmd.AddCommand(newPushCmd(engineClients.ContainerTasks, engineClients.Kubernetes, engineClients.HTTP, engineClients.Nomad, l))
rootCmd.AddCommand(newLogCmd(engine, engineClients.Docker, os.Stdout, os.Stderr), completionCmd)

// add the server commands
rootCmd.AddCommand(connectorCmd)
connectorCmd.AddCommand(newConnectorRunCommand())
connectorCmd.AddCommand(connectorStopCmd)
connectorCmd.AddCommand(newConnectorCertCmd())
func createEngine(l logger.Logger, c *clients.Clients) (jumppad.Engine, gvm.Versions, error) {

// add the generate command
rootCmd.AddCommand(generateCmd)
generateCmd.AddCommand(newGenerateReadmeCommand(engine))
}

func createEngine(l logger.Logger) (jumppad.Engine, *clients.Clients, gvm.Versions) {
engineClients, err := clients.GenerateClients(l)
if err != nil {
return nil, nil, nil
}

providers := config.NewProviders(engineClients)
providers := config.NewProviders(c)

engine, err := jumppad.New(providers, l)
if err != nil {
panic(err)
return nil, nil, err
}

o := gvm.Options{
Organization: "jumppad-labs",
Repo: "jumppad",
ReleasesPath: utils.GetReleasesFolder(),
ReleasesPath: utils.ReleasesFolder(),
}

o.AssetNameFunc = func(version, goos, goarch string) string {
Expand Down Expand Up @@ -112,7 +70,7 @@ func createEngine(l logger.Logger) (jumppad.Engine, *clients.Clients, gvm.Versio

vm := gvm.New(o)

return engine, engineClients, vm
return engine, vm, nil
}

func createLogger() logger.Logger {
Expand All @@ -130,9 +88,52 @@ func Execute(v, c, d string) error {
commit = c
date = d

var vm gvm.Versions

// setup dependencies
l := createLogger()

engineClients, _ := clients.GenerateClients(l)

// Check the system to see if Docker is running and everything is installed
s, err := engineClients.System.Preflight()
if err != nil {
fmt.Println("")
fmt.Println("###### SYSTEM DIAGNOSTICS ######")
fmt.Println(s)
return err
}

engine, vm, _ := createEngine(l, engineClients)

rootCmd.AddCommand(checkCmd)
rootCmd.AddCommand(outputCmd)
rootCmd.AddCommand(newDevCmd())
rootCmd.AddCommand(newEnvCmd(engine))
rootCmd.AddCommand(newRunCmd(engine, engineClients.ContainerTasks, engineClients.Getter, engineClients.HTTP, engineClients.System, vm, engineClients.Connector, l))
rootCmd.AddCommand(newTestCmd())
rootCmd.AddCommand(newDestroyCmd(engineClients.Connector))
rootCmd.AddCommand(statusCmd)
rootCmd.AddCommand(newPurgeCmd(engineClients.Docker, engineClients.ImageLog, l))
rootCmd.AddCommand(taintCmd)
rootCmd.AddCommand(newVersionCmd(vm))
rootCmd.AddCommand(uninstallCmd)
rootCmd.AddCommand(newPushCmd(engineClients.ContainerTasks, engineClients.Kubernetes, engineClients.HTTP, engineClients.Nomad, l))
rootCmd.AddCommand(newLogCmd(engine, engineClients.Docker, os.Stdout, os.Stderr), completionCmd)

// add the server commands
rootCmd.AddCommand(connectorCmd)
connectorCmd.AddCommand(newConnectorRunCommand())
connectorCmd.AddCommand(connectorStopCmd)
connectorCmd.AddCommand(newConnectorCertCmd())

// add the generate command
rootCmd.AddCommand(generateCmd)
generateCmd.AddCommand(newGenerateReadmeCommand(engine))

rootCmd.SilenceErrors = true

err := rootCmd.Execute()
err = rootCmd.Execute()

if err != nil {
fmt.Println("")
Expand Down
Loading
Loading