-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for role dependencies (#11)
* Add support for role local and galaxy dependencies
- Loading branch information
Showing
53 changed files
with
1,063 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
name: Build and test | ||
name: Test | ||
run-name: Test ${{ github.ref_name }} triggered by @${{ github.actor }} | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
|
||
build-linux: | ||
test-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
- name: Set up go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
go-version-file: go.mod | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
run: go test -v ./... -coverprofile=cover.out | ||
|
||
build-windows: | ||
test-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
- name: Test | ||
run: go test -v ./... -coverprofile=cover.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
dist/ | ||
.idea/ | ||
.vscode/ | ||
rolecule | ||
rolecule.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[env] | ||
mise.path = ["./bin"] | ||
GO_VERSION = "{{exec(command='grep \"^go 1\\.[0-9]\\+\\.[0-9]\\+$\" go.mod | cut -f2 -d\" \"')}}" | ||
|
||
[tools] | ||
golang = "{{exec(command='grep \"^go 1\\.[0-9]\\+\\.[0-9]\\+$\" go.mod | cut -f2 -d\" \"')}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2022 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
@@ -33,14 +30,20 @@ var convergeCmd = &cobra.Command{ | |
func converge(cfg *config.Config) error { | ||
for _, instance := range cfg.Instances { | ||
if !instance.Engine.Exists(instance.Name) { | ||
log.Errorf("container does not exist, creating...") | ||
err := create(cfg) | ||
if err != nil { | ||
log.Error(err.Error()) | ||
continue | ||
} | ||
} | ||
|
||
if len(instance.Provisioner.GetDependencies().GalaxyRoles) > 0 { | ||
log.Infof("preparing container %s", instance.Name) | ||
if err := instance.Prepare(); err != nil { | ||
log.Error(err.Error()) | ||
} | ||
} | ||
|
||
log.Infof("converging container %s with %s", instance.Name, instance.Provisioner) | ||
if err := instance.Converge(); err != nil { | ||
log.Error(err.Error()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
@@ -21,8 +18,8 @@ var rootCmd = &cobra.Command{ | |
Use: "rolecule", | ||
Short: "rolecule helps you test your ansible roles", | ||
Long: `rolecule uses docker or podman to test your | ||
configuration management roles/recipes/modules in a systemd enabled container, | ||
then tests them with a verifier (goss/testinfra).`, | ||
ansible roles in a systemd enabled container, | ||
then tests them with a verifier (goss).`, | ||
|
||
PersistentPreRun: func(cmd *cobra.Command, args []string) { | ||
log.SetHandler(cli.New(os.Stderr)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/z0mbix/rolecule | ||
|
||
go 1.19 | ||
go 1.23.0 | ||
|
||
require ( | ||
github.com/apex/log v1.9.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* | ||
Copyright © 2023 David Wooldridge <[email protected]> | ||
*/ | ||
package main | ||
|
||
import "github.com/z0mbix/rolecule/cmd" | ||
|
Oops, something went wrong.