Skip to content

Commit

Permalink
Merge branch 'main' into registry
Browse files Browse the repository at this point in the history
  • Loading branch information
eveld committed Nov 22, 2024
2 parents f926a12 + 7cf9b74 commit 13a6319
Show file tree
Hide file tree
Showing 54 changed files with 1,065 additions and 906 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/build_and_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ jobs:
verb: call
module: ./dagger
args: all --output=./output --src=. --github-token=GITHUB_TOKEN --notorize-cert=./cert.p12 --notorize-cert-password=QUILL_SIGN_PASSWORD --notorize-key=./key.p8 --notorize-id=${{secrets.QUILL_NOTARY_KEY_ID}} --notorize-issuer=${{secrets.QUILL_NOTARY_ISSUER}}
version: "0.11.0"
version: "0.11.5"
dagger-flags: "--progress=plain"

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: archives
path: |
Expand Down Expand Up @@ -69,7 +70,7 @@ jobs:

steps:
- name: Download-Binaries
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: archives
path: ./build_artifacts
Expand All @@ -89,7 +90,8 @@ jobs:
verb: call
module: ./dagger
args: functional-test --src=./examples --working-directory=${{matrix.folder}} --jumppad=/usr/local/bin/jumppad --runtime=docker
version: "0.11.0"
version: "0.11.5"
dagger-flags: "--progress=plain"

- name: Send status to Discord
uses: sarisia/actions-status-discord@v1
Expand Down Expand Up @@ -122,7 +124,7 @@ jobs:

steps:
- name: Download-Binaries
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: archives
path: ./build_artifacts
Expand All @@ -142,7 +144,8 @@ jobs:
verb: call
module: ./dagger
args: functional-test --src=./examples --working-directory=${{matrix.folder}} --jumppad=/usr/local/bin/jumppad --runtime=podman
version: "0.11.0"
version: "0.11.5"
dagger-flags: "--progress=plain"

- name: Send status to Discord
uses: sarisia/actions-status-discord@v1
Expand Down Expand Up @@ -171,7 +174,7 @@ jobs:
- uses: actions/checkout@v2

- name: Download-Binaries
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: archives
path: ./build_artifacts
Expand All @@ -182,7 +185,8 @@ jobs:
verb: call
module: ./dagger
args: release --src=. --github-token=GITHUB_TOKEN --gemfury-token=GEMFURY_TOKEN --archives=./build_artifacts --output=./version.txt
version: "0.11.0"
version: "0.11.5"
dagger-flags: "--progress=plain"

- name: Set output
id: setoutput
Expand Down
24 changes: 21 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug - Up Docs Debugging",
"name": "Attach to Connector Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": "${command:pickGoProcess}",
},
{
"name": "Debug - Dev Docs Debugging",
"type": "go",
"request": "launch",
"mode": "debug",
Expand All @@ -11,8 +18,9 @@
"LOG_LEVEL": "debug"
},
"args": [
"up",
"/home/nicj/go/src/github.com/nicholasjackson/workshop-kubernetes-secrets",
"dev",
"--disable-tty",
"/home/nicj/go/src/github.com/nicholasjackson/workshop-vault-kubernetes/jumppad",
],
},
{
Expand Down Expand Up @@ -166,6 +174,16 @@
"showDirs": true,
"fromFolder": { "fixed": "${workspaceFolder}/examples/" }
}
},
{
"id": "connectorProcess",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "ps axww --no-headers k comm -o '%p|%c|%p|%a'| grep '[c]onnector run' | sed -e 's/^\\s*//' -e 's/\\s*|\\s*/|/g'", "fieldSeparator": "|",
"description": "Select the process to attach to",
"useFirstResult": "true",
}
}
]
}
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## version v0.11.2

Require ipv6 networking to be manually enabled via the network config. If
ipv6 is disabled all containers are started with ipv6 disabled.

## version v0.10.5

## New Features:
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ git_commit = $(shell git log -1 --pretty=format:"%H")
test_folder ?= container

test_unit:
dagger call --mod=dagger unit-test \
dagger call --mod=dagger --progress=plain unit-test \
--src=. \
--with-race=false

Expand Down Expand Up @@ -54,5 +54,8 @@ generate_mocks:

install_local:
go build -ldflags "-X main.version=${git_commit}" -gcflags=all="-N -l" -o bin/jumppad main.go
sudo mv /usr/local/bin/jumppad /usr/local/bin/jumppad-old || true
sudo cp bin/jumppad /usr/local/bin/jumppad
sudo mv /usr/bin/jumppad /usr/bin/jumppad-old || true
sudo cp bin/jumppad /usr/bin/jumppad

remove_local:
sudo mv /usr/bin/jumppad-old /usr/bin/jumppad || true
24 changes: 17 additions & 7 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/jumppad-labs/jumppad/cmd/view"
"github.com/jumppad-labs/jumppad/pkg/clients"
"github.com/jumppad-labs/jumppad/pkg/config"
"github.com/jumppad-labs/jumppad/pkg/jumppad"
"github.com/jumppad-labs/jumppad/pkg/utils"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -154,8 +155,18 @@ func doUpdates(v view.View, e jumppad.Engine, source string, variables map[strin
v.Logger().Debug("W_Init: shareware version...............................")
v.Logger().Debug("startskill: 2 deathmatch: 0 startepisode: 1")

v.UpdateStatus("Checking for changes...", false)
// first check if the state exists
// if not we need to do an apply then we can go into the check loop
_, err := config.LoadState()
if err != nil {
v.UpdateStatus("Applying initial configuration...", false)
_, err := e.ApplyWithVariables(context.Background(), source, variables, variableFile)
if err != nil {
v.Logger().Error(err.Error())
}
}

v.UpdateStatus("Checking for changes...", false)
for {
time.Sleep(interval)

Expand All @@ -164,19 +175,18 @@ func doUpdates(v view.View, e jumppad.Engine, source string, variables map[strin
v.Logger().Error(err.Error())
}

v.Logger().Debug("Changes detected", "new", len(new), "changed", len(changed), "removed", len(removed))
for _, n := range changed {
v.Logger().Debug("Changed", "resource", n.Metadata().ID)
}

if len(new) > 0 || len(changed) > 0 || len(removed) > 0 {
v.UpdateStatus(
fmt.Sprintf(
"Applying changes, %d resources to add, %d resources changed, %d resources to delete, running up",
len(new),
len(changed),
len(removed),
), true)
), false)

for _, n := range changed {
v.Logger().Debug("Changed", "resource", n.Metadata().ID)
}

_, err := e.ApplyWithVariables(context.Background(), source, variables, variableFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/server_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func newConnectorRunCommand() *cobra.Command {

// start the http server in the background
l.Info("Starting HTTP server", "bind_addr", httpBindAddr)
httpS := http.NewLocalServer(pathCertRoot, pathCertServer, pathKeyServer, grpcBindAddr, httpBindAddr, logger.LoggerAsHCLogger(l))
httpS := http.NewLocalServer(pathCertRoot, "", pathCertServer, pathKeyServer, grpcBindAddr, httpBindAddr, logger.LoggerAsHCLogger(l))

err = httpS.Serve()
l.Info("Started")
Expand Down
44 changes: 22 additions & 22 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ func newRunCmdFunc(e jumppad.Engine, dt cclients.ContainerTasks, bp getter.Gette
// parse the vars into a map
vars := map[string]string{}
for _, v := range *variables {
// if the variable is wrapped in single quotes remove them
v = strings.TrimPrefix(v, "'")
v = strings.TrimSuffix(v, "'")

parts := strings.Split(v, "=")
if len(parts) == 2 {
vars[parts[0]] = parts[1]
if len(parts) >= 2 {
vars[parts[0]] = strings.Join(parts[1:], "=")
}
}

Expand Down Expand Up @@ -173,7 +177,7 @@ func newRunCmdFunc(e jumppad.Engine, dt cclients.ContainerTasks, bp getter.Gette
cancel()
}()

res, err := e.ApplyWithVariables(ctx, dst, vars, *variablesFile)
config, err := e.ApplyWithVariables(ctx, dst, vars, *variablesFile)
if err != nil {
return err
}
Expand All @@ -184,30 +188,26 @@ func newRunCmdFunc(e jumppad.Engine, dt cclients.ContainerTasks, bp getter.Gette
browserList := []string{}
checkDuration := 30 * time.Second

for _, r := range res.Resources {
switch r.Metadata().Type {
case container.TypeContainer:
c := r.(*container.Container)
for _, p := range c.Ports {
for _, r := range config.Resources {
switch v := r.(type) {
case *container.Container:
for _, p := range v.Ports {
if p.Host != "" && p.OpenInBrowser != "" {
browserList = append(browserList, buildBrowserPath(r.Metadata().Name, p.Host, r.Metadata().Type, p.OpenInBrowser))
}
}
case ingress.TypeIngress:
c := r.(*ingress.Ingress)
if c.OpenInBrowser != "" {
browserList = append(browserList, buildBrowserPath(r.Metadata().Name, fmt.Sprintf("%d", c.Port), r.Metadata().Type, c.OpenInBrowser))
case *ingress.Ingress:
if v.OpenInBrowser != "" {
browserList = append(browserList, buildBrowserPath(r.Metadata().Name, fmt.Sprintf("%d", v.Port), r.Metadata().Type, v.OpenInBrowser))
}
case nomad.TypeNomadCluster:
c := r.(*nomad.NomadCluster)
if c.OpenInBrowser {
case *nomad.NomadCluster:
if v.OpenInBrowser {
// get the API port
browserList = append(browserList, buildBrowserPath("server."+r.Metadata().Name, fmt.Sprintf("%d", c.APIPort), r.Metadata().Type, "/"))
browserList = append(browserList, buildBrowserPath("server."+r.Metadata().Name, fmt.Sprintf("%d", v.APIPort), r.Metadata().Type, "/"))
}
case docs.TypeDocs:
c := r.(*docs.Docs)
if c.OpenInBrowser {
port := strconv.Itoa(c.Port)
case *docs.Docs:
if v.OpenInBrowser {
port := strconv.Itoa(v.Port)
if port == "0" {
port = "80"
}
Expand All @@ -225,7 +225,7 @@ func newRunCmdFunc(e jumppad.Engine, dt cclients.ContainerTasks, bp getter.Gette
for _, b := range browserList {
go func(uri string) {
// health check the URL
err := hc.HealthCheckHTTP(uri, "", nil, "", []int{200}, checkDuration)
err := hc.HealthCheckHTTP(uri, "", map[string][]string{}, "", []int{200}, checkDuration)
if err == nil {
be := bc.OpenBrowser(uri)
if be != nil {
Expand All @@ -246,7 +246,7 @@ func newRunCmdFunc(e jumppad.Engine, dt cclients.ContainerTasks, bp getter.Gette

// if we have a blueprint show the header
var b *blueprint.Blueprint
bps, _ := e.Config().FindResourcesByType(blueprint.TypeBlueprint)
bps, _ := config.FindResourcesByType(blueprint.TypeBlueprint)
for _, bp := range bps {
// pick the first blueprint in the root
if bp.Metadata().Module == "" {
Expand Down
Loading

0 comments on commit 13a6319

Please sign in to comment.