Skip to content

Commit c6a8346

Browse files
Merge pull request #353 from jumppad-labs/f-new-hclconfig
Bump hclconfig to use the new v0.29.0 version of hclconfig
2 parents 3d57baa + fb61895 commit c6a8346

File tree

10 files changed

+48
-29
lines changed

10 files changed

+48
-29
lines changed

.github/workflows/build_and_deploy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
if: always()
4343
with:
4444
webhook: ${{ secrets.DISCORD_WEBHOOK }}
45-
tile: ${{ github.job_id }}
45+
title: ${{ github.job_id }}
4646
description: "Build application"
4747

4848
functional_test_docker:
@@ -98,7 +98,7 @@ jobs:
9898
if: always()
9999
with:
100100
webhook: ${{ secrets.DISCORD_WEBHOOK }}
101-
tile: ${{ github.job_id }}
101+
title: ${{ github.job_id }}
102102
description: "Functional tests for docker: ${{matrix.folder}}"
103103

104104
functional_test_podman:
@@ -152,7 +152,7 @@ jobs:
152152
if: always()
153153
with:
154154
webhook: ${{ secrets.DISCORD_WEBHOOK }}
155-
tile: ${{ github.job_id }}
155+
title: ${{ github.job_id }}
156156
description: "Functional tests for ${{matrix.folder}}"
157157

158158
release:
@@ -228,6 +228,6 @@ jobs:
228228
uses: sarisia/actions-status-discord@v1
229229
if: always()
230230
with:
231-
tile: ${{ github.job_id }}
231+
title: ${{ github.job_id }}
232232
webhook: ${{ secrets.DISCORD_WEBHOOK }}
233233
description: "Push new version ${{ needs.github_release.outputs.version }} to Winget"

examples/registries/build.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "container" "noauth" {
3939
}
4040

4141
volume {
42-
source = data("certs")
42+
source = resource.certificate_leaf.registry.output
4343
destination = "/certs"
4444
}
4545
}
@@ -75,7 +75,7 @@ resource "container" "auth" {
7575
}
7676

7777
volume {
78-
source = data("certs")
78+
source = resource.certificate_leaf.registry.output
7979
destination = "/certs"
8080
}
8181
}

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ module github.com/jumppad-labs/jumppad
44
// https://github.com/docker/cli/issues/4437
55
// fixed it by using docker v23.0.7-0.20230714215826-f00e7af96042+incompatible
66
// switch to v24.0.4+incompatible once github actions updates their docker version
7-
go 1.23.0
8-
9-
toolchain go1.23.5
7+
go 1.24.3
108

119
require (
1210
github.com/Masterminds/semver v1.5.0
@@ -36,7 +34,7 @@ require (
3634
github.com/infinytum/raymond/v2 v2.0.5
3735
github.com/jumppad-labs/connector v0.4.0
3836
github.com/jumppad-labs/gohup v0.4.0
39-
github.com/jumppad-labs/hclconfig v0.28.0
37+
github.com/jumppad-labs/hclconfig v0.29.0
4038
github.com/jumppad-labs/plugin-sdk v0.4.0
4139
github.com/kennygrant/sanitize v1.2.4
4240
github.com/mattn/go-isatty v0.0.20

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,10 +1174,8 @@ github.com/jumppad-labs/go-cty v0.0.0-20230804061424-9e985cb751f6 h1:1ADItCWr5pr
11741174
github.com/jumppad-labs/go-cty v0.0.0-20230804061424-9e985cb751f6/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
11751175
github.com/jumppad-labs/gohup v0.4.0 h1:0OplHvnKnOLkqWm417sRHLSiJ4xGeb8LiSSAJ51QrYg=
11761176
github.com/jumppad-labs/gohup v0.4.0/go.mod h1:JYvZnemxJlWDyx8RbDNcCBLZSvIrYlYLnkQqR1BKFW4=
1177-
github.com/jumppad-labs/hclconfig v0.26.0 h1:Qg/tC2WlhKwoTW0acAY/vyUXHwCuyr4NmshKLS81How=
1178-
github.com/jumppad-labs/hclconfig v0.26.0/go.mod h1:AOzW0btnKiqUKYVi3ioGzSPNCWsTzsJxKcqzVORccvk=
1179-
github.com/jumppad-labs/hclconfig v0.28.0 h1:6V6dMrTufkLHgyFdtJHiEcDM5hp9ItVNDZf98wGpVKs=
1180-
github.com/jumppad-labs/hclconfig v0.28.0/go.mod h1:mrKi8iCDAqLwmhbOa5k1K56R4+ctsVuYveQ/sMaWYio=
1177+
github.com/jumppad-labs/hclconfig v0.29.0 h1:ZJKsei7agJ8wEx+r0iZQsOKWYxWvN8Wldd5/897xBxk=
1178+
github.com/jumppad-labs/hclconfig v0.29.0/go.mod h1:UiDq9kWaSsw5MQp0iDej2oxvo0E+Xwx7UVuEDlzetnw=
11811179
github.com/jumppad-labs/log v0.0.0-20240827082827-4404884e31a7 h1:tuoFYWXAqT5BheDlQNumY1DxvkW8bjG9JOzoxpFneZs=
11821180
github.com/jumppad-labs/log v0.0.0-20240827082827-4404884e31a7/go.mod h1:S9jhxE2C1+jv2PlLTAow3h+ZILzvXRhd6eBjFAUcfgI=
11831181
github.com/jumppad-labs/plugin-sdk v0.4.0 h1:deNk7h8W+6dsxj2ADP63o07Dv313vcBI8C4d1aBUO/c=
@@ -1536,8 +1534,6 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
15361534
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
15371535
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
15381536
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
1539-
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
1540-
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
15411537
golang.org/x/crypto v0.34.0 h1:+/C6tk6rf/+t5DhUketUbD1aNGqiSX3j15Z6xuIDlBA=
15421538
golang.org/x/crypto v0.34.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
15431539
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=

pkg/clients/container/docker_tasks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ func copyDir(src string, dest string) error {
15291529
return err
15301530
}
15311531
if !file.IsDir() {
1532-
return fmt.Errorf("Source " + file.Name() + " is not a directory!")
1532+
return fmt.Errorf("source %s is not a directory", file.Name())
15331533
}
15341534

15351535
err = os.Mkdir(dest, 0755)

pkg/config/resources/exec/provider.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12+
"github.com/jumppad-labs/hclconfig/convert"
1213
htypes "github.com/jumppad-labs/hclconfig/types"
1314
"github.com/jumppad-labs/jumppad/pkg/clients"
1415
cmdClient "github.com/jumppad-labs/jumppad/pkg/clients/command"
@@ -18,6 +19,7 @@ import (
1819
"github.com/jumppad-labs/jumppad/pkg/clients/logger"
1920
"github.com/jumppad-labs/jumppad/pkg/utils"
2021
sdk "github.com/jumppad-labs/plugin-sdk"
22+
"github.com/zclconf/go-cty/cty"
2123
)
2224

2325
// checks Provider implements the sdk.Provider interface
@@ -361,7 +363,17 @@ func (p *Provider) generateOutput() error {
361363
output[parts[0]] = parts[1]
362364
}
363365

364-
p.config.Output = output
366+
values := map[string]cty.Value{}
367+
for k, v := range output {
368+
value, err := convert.GoToCtyValue(v)
369+
if err != nil {
370+
return fmt.Errorf("unable to convert output value to cty: %w", err)
371+
}
372+
373+
values[k] = value
374+
}
375+
376+
p.config.Output = cty.ObjectVal(values)
365377

366378
return nil
367379
}

pkg/config/resources/exec/provider_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestParsesOutput(t *testing.T) {
6262
err := p.Create(context.Background())
6363
require.NoError(t, err)
6464

65-
require.True(t, e.Output["FOO"] == "BAR")
65+
require.True(t, e.Output.AsValueMap()["FOO"].AsString() == "BAR")
6666
}
6767

6868
func TestDeletesOutput(t *testing.T) {

pkg/config/resources/exec/resource.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/jumppad-labs/jumppad/pkg/config"
99
ctypes "github.com/jumppad-labs/jumppad/pkg/config/resources/container"
1010
"github.com/jumppad-labs/jumppad/pkg/utils"
11+
"github.com/zclconf/go-cty/cty"
1112
)
1213

1314
// TypeExec is the resource string for an Exec resource
@@ -33,10 +34,10 @@ type Exec struct {
3334
RunAs *ctypes.User `hcl:"run_as,block" json:"run_as,omitempty"` // User block for mapping the user id and group id inside the container
3435

3536
// output
36-
PID int `hcl:"pid,optional" json:"pid,omitempty"` // PID stores the ID of the created connector service if it is a local exec
37-
ExitCode int `hcl:"exit_code,optional" json:"exit_code,omitempty"` // Exit code of the process
38-
Output map[string]string `hcl:"output,optional" json:"output,omitempty"` // output values returned from exec
39-
Checksum string `hcl:"checksum,optional" json:"checksum,omitempty"` // Checksum of the script
37+
PID int `hcl:"pid,optional" json:"pid,omitempty"` // PID stores the ID of the created connector service if it is a local exec
38+
ExitCode int `hcl:"exit_code,optional" json:"exit_code,omitempty"` // Exit code of the process
39+
Output cty.Value `hcl:"output,optional" json:"output,omitempty"` // output values returned from exec
40+
Checksum string `hcl:"checksum,optional" json:"checksum,omitempty"` // Checksum of the script
4041
}
4142

4243
func (e *Exec) Process() error {

pkg/config/resources/terraform/provider.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ func (p *TerraformProvider) terraformApply(containerid string) error {
313313
wd := path.Join("/config", p.config.WorkingDirectory)
314314

315315
script := `#!/bin/sh
316+
set -e
317+
316318
terraform init \
317319
-no-color
318320
terraform apply \
@@ -421,6 +423,8 @@ func (p *TerraformProvider) terraformDestroy(containerid string) error {
421423
tfvarFlag := getTerraformVarsFlag(p.config)
422424

423425
script := `#!/bin/sh
426+
set -e
427+
424428
terraform init \
425429
-no-color
426430
terraform destroy \

pkg/jumppad/engine.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"log"
1010
"os"
1111
"path/filepath"
12+
"sync"
1213

1314
"github.com/jumppad-labs/hclconfig"
1415
hclerrors "github.com/jumppad-labs/hclconfig/errors"
@@ -43,18 +44,20 @@ type Engine interface {
4344

4445
// EngineImpl is responsible for creating and destroying resources
4546
type EngineImpl struct {
46-
providers config.Providers
47-
log logger.Logger
48-
config *hclconfig.Config
49-
ctx context.Context
50-
force bool
47+
providers config.Providers
48+
log logger.Logger
49+
config *hclconfig.Config
50+
ctx context.Context
51+
force bool
52+
cacheMutex sync.Mutex
5153
}
5254

5355
// New creates a new Jumppad engine
5456
func New(p config.Providers, l logger.Logger) (Engine, error) {
5557
e := &EngineImpl{}
5658
e.log = l
5759
e.providers = p
60+
e.cacheMutex = sync.Mutex{}
5861

5962
// Set the standard writer to our logger as the DAG uses the standard library log.
6063
log.SetOutput(l.StandardWriter())
@@ -534,6 +537,7 @@ func (e *EngineImpl) createCallback(r types.Resource) error {
534537
// to the network and set the dependency
535538
if r.Metadata().Type == network.TypeNetwork && r.Metadata().Properties[constants.PropertyStatus] == constants.StatusCreated {
536539
// get the image cache
540+
e.cacheMutex.Lock()
537541
ic, err := e.config.FindResource("resource.image_cache.default")
538542
if err == nil {
539543
e.log.Debug("Attaching image cache to network", "network", ic.Metadata().ID)
@@ -545,10 +549,12 @@ func (e *EngineImpl) createCallback(r types.Resource) error {
545549
} else {
546550
e.log.Error("Unable to find Image Cache", "error", err)
547551
}
552+
e.cacheMutex.Unlock()
548553
}
549554

550555
if r.Metadata().Type == cache.TypeRegistry && r.Metadata().Properties[constants.PropertyStatus] == constants.StatusCreated {
551556
// get the image cache
557+
e.cacheMutex.Lock()
552558
ic, err := e.config.FindResource("resource.image_cache.default")
553559
if err == nil {
554560
// append the registry if not all ready present and not in the default list
@@ -570,11 +576,13 @@ func (e *EngineImpl) createCallback(r types.Resource) error {
570576
ic.(*cache.ImageCache).Registries = append(ic.(*cache.ImageCache).Registries, *r.(*cache.Registry))
571577
}
572578

573-
e.log.Debug("Adding registy to image cache", "registry", r.(*cache.Registry).Hostname)
579+
e.log.Debug("Adding registry to image cache", "registry", r.(*cache.Registry).Hostname)
574580

575581
// we now need to stop and restart the container to pick up the new registry changes
576582
np := e.providers.GetProvider(ic)
577583

584+
e.cacheMutex.Unlock()
585+
578586
err := np.Destroy(e.ctx, e.force)
579587
if err != nil {
580588
e.log.Error("Unable to destroy Image Cache", "error", err)

0 commit comments

Comments
 (0)