Skip to content

Commit

Permalink
chore: automate Zarf upgrades in code (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGedd authored Nov 29, 2023
1 parent c6affb0 commit b197cf3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/actions/zarf/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ runs:
steps:
- uses: defenseunicorns/setup-zarf@main
with:
# renovate: datasource=github-tags depName=defenseunicorns/zarf versioning=semver
version: v0.31.1
# renovate: datasource=github-tags depName=defenseunicorns/zarf
version: v0.31.2
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ __debug_bin
sboms
bundle-sboms
node_modules
checksums.txt
checksums.txt
*.tape
19 changes: 18 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,22 @@
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
"rebaseWhen": "conflicted",
"commitBodyTable": true,
"suppressNotifications": ["prIgnoreNotification"]
"suppressNotifications": ["prIgnoreNotification"],
"postUpdateOptions": [
"gomodTidy"
],
"regexManagers": [
{
"fileMatch": [
"(^|/)uds-bundle.yaml$",
"(^|/)action.yaml$"
],
"matchStringsStrategy": "recursive",
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?( registryUrl=(?<registryUrl>.*?))?\\s.*?version: (?<currentValue>.*)\\s",
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?( registryUrl=(?<registryUrl>.*?))?\\s.*?ref: (?<currentValue>.*)\\s"
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
}
]
}
8 changes: 5 additions & 3 deletions src/test/bundles/04-init/uds-bundle.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
kind: UDSBundle
metadata:
name: all-the-inits
description: deploys both s local and remote init packages
description: deploys both local and remote init packages
version: 0.0.1

# contrived bundle to test local + remote Zarf inits
# cannot do uds remove on this pkg due to having the same name
zarf-packages:
- name: init
path: "../../packages"
ref: v0.31.1
# renovate: datasource=github-tags depName=defenseunicorns/zarf
ref: v0.31.2
optional-components:
- git-server
- name: init
# renovate: datasource=github-tags depName=defenseunicorns/zarf
repository: ghcr.io/defenseunicorns/packages/init
ref: v0.31.1
ref: v0.31.2
optional-components:
- git-server
16 changes: 13 additions & 3 deletions src/test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"golang.org/x/mod/modfile"

"github.com/defenseunicorns/uds-cli/src/test"

Expand Down Expand Up @@ -90,16 +91,25 @@ func doAllTheThings(m *testing.M) (int, error) {

func deployZarfInit(t *testing.T) {
if !zarfInitDeployed() {
// todo: renovate this version or grab from deps
zarfVersion := "v0.31.1"
// get Zarf version from go.mod
b, err := os.ReadFile("go.mod")
require.NoError(t, err)
f, err := modfile.Parse("go.mod", b, nil)
require.NoError(t, err)
var zarfVersion string
for _, r := range f.Require {
if r.Mod.Path == "github.com/defenseunicorns/zarf" {
zarfVersion = r.Mod.Version
}
}
e2e.DownloadZarfInitPkg(t, zarfVersion)

bundleDir := "src/test/bundles/04-init"
bundlePath := filepath.Join(bundleDir, fmt.Sprintf("uds-bundle-all-the-inits-%s-0.0.1.tar.zst", e2e.Arch))

// Create
cmd := strings.Split(fmt.Sprintf("create %s --confirm --insecure", bundleDir), " ")
_, _, err := e2e.UDS(cmd...)
_, _, err = e2e.UDS(cmd...)
require.NoError(t, err)

// Deploy
Expand Down

0 comments on commit b197cf3

Please sign in to comment.