-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added terraform template * feat(workflow): add manual trigger for Terraform GitHub Actions workflow - Added `workflow_dispatch` to allow manual triggering of the workflow. - This change enhances the flexibility of the CI/CD pipeline by enabling on-demand execution. * refactor: update build configurations and flake.nix for Go module - Removed `goPackage` and `buildGoModule` parameters from `build-configs.yaml`. - Updated `flake.nix` to use `buildGoModule` instead of `buildGo122Module`. - Added `version` and `CgoEnabled` fields to `GoCobraCliConfig` in `go_cobra_cli.go`. - Updated `internal/templates/templates/go-cobra-cli/flake.nix` to include `version` and `CgoEnabled` fields. * feat: added terraform-module template
- Loading branch information
1 parent
2380f63
commit bb656e7
Showing
24 changed files
with
619 additions
and
104 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base", | ||
":semanticCommitTypeAll(chore)" | ||
], | ||
"lockFileMaintenance": { | ||
"enabled": true, | ||
"extends": [ | ||
"schedule:weekly" | ||
] | ||
}, | ||
"nix": { | ||
"enabled": true | ||
} | ||
} |
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,3 +1,4 @@ | ||
.direnv | ||
/.direnv | ||
/build-configs | ||
/result | ||
/target |
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 |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
issues: | ||
exclude: | ||
- Error return value of `\(github.com/go-kit/log.Logger\).Log` is not checked | ||
|
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,48 +1,33 @@ | ||
{ | ||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | ||
|
||
outputs = inputs@{ flake-parts, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; | ||
outputs = inputs @ {flake-parts, ...}: | ||
flake-parts.lib.mkFlake {inherit inputs;} { | ||
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; | ||
|
||
perSystem = { config, pkgs, ... }: | ||
let | ||
inherit (pkgs) | ||
go_1_22 | ||
just; | ||
|
||
name = "build-configs"; | ||
version = "0.1.0"; | ||
CGO_ENABLED = "0"; | ||
in | ||
{ | ||
devShells.default = pkgs.mkShell { | ||
buildInputs = [ just ]; | ||
inputsFrom = [ config.packages.default ]; | ||
}; | ||
|
||
packages = { | ||
default = pkgs.buildGo122Module { | ||
inherit name version; | ||
GOFLAGS = [ | ||
"-ldflags=github.com/ALT-F4-LLC/build-configs/internal/cli.Version=${version}" | ||
]; | ||
src = ./.; | ||
vendorHash = "sha256-6B9O6ho4COpJy4HlkzQ0lk+ieezRO3xg9LyLHzoxYzc="; | ||
buildModules = [ "cmd/${name}" ]; | ||
}; | ||
perSystem = { | ||
config, | ||
pkgs, | ||
... | ||
}: let | ||
inherit (pkgs) just; | ||
name = "build-configs"; | ||
version = "0.1.0"; | ||
CGO_ENABLED = "0"; | ||
in { | ||
devShells.default = pkgs.mkShell { | ||
buildInputs = [just]; | ||
inputsFrom = [config.packages.default]; | ||
}; | ||
|
||
docker = pkgs.dockerTools.buildImage { | ||
inherit name; | ||
tag = "latest"; | ||
config = { | ||
Entrypoint = [ "${config.packages.default}/bin/${name}" ]; | ||
Env = [ | ||
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" | ||
]; | ||
}; | ||
}; | ||
packages = { | ||
default = pkgs.buildGoModule { | ||
inherit CGO_ENABLED name version; | ||
src = ./.; | ||
subPackages = ["cmd/${name}"]; | ||
vendorHash = "sha256-6B9O6ho4COpJy4HlkzQ0lk+ieezRO3xg9LyLHzoxYzc="; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
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
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,62 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ALT-F4-LLC/build-configs/internal/templates" | ||
) | ||
|
||
const TerraformName = "terraform" | ||
|
||
type TerraformConfigRole struct { | ||
PlanARN string `json:"planArn,omitempty" yaml:"planArn,omitempty"` | ||
ApplyARN string `json:"applyArn,omitempty" yaml:"applyArn,omitempty"` | ||
} | ||
|
||
type TerraformConfig struct { | ||
Config | ||
Nix NixConfig `json:"nix,omitempty" yaml:"nix,omitempty"` | ||
Region string `json:"region,omitempty" yaml:"region,omitempty"` | ||
Role TerraformConfigRole `json:"role,omitempty" yaml:"role,omitempty"` | ||
Schedule *string `json:"schedule,omitempty" yaml:"schedule,omitempty"` | ||
Providers []string `json:"providers,omitempty" yaml:"providers,omitempty"` | ||
} | ||
|
||
func NewTerraformConfigRole(name string) TerraformConfigRole { | ||
return TerraformConfigRole{ | ||
ApplyARN: fmt.Sprintf("arn:aws:iam::677459762413:role/altf4llc-gha-%s-apply", name), | ||
PlanARN: fmt.Sprintf("arn:aws:iam::677459762413:role/altf4llc-gha-%s-plan", name), | ||
} | ||
} | ||
|
||
func NewTerraformConfig(c Config) TerraformConfig { | ||
return TerraformConfig{ | ||
Config: c, | ||
Nix: NewNixConfig(), | ||
Region: "us-west-2", | ||
Role: NewTerraformConfigRole(c.Name), | ||
Schedule: nil, | ||
} | ||
} | ||
|
||
func (c TerraformConfig) Render() error { | ||
renderMap := templates.RenderMap{ | ||
templates.AllCommonTemplates: { | ||
".envrc", | ||
".github/renovate.json", | ||
}, | ||
templates.TerraformTemplates: { | ||
".github/workflows/terraform.yaml", | ||
".gitignore", | ||
"flake.nix", | ||
"justfile", | ||
}, | ||
} | ||
|
||
files, err := templates.RenderTemplates(renderMap, c) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return templates.WriteFiles(files) | ||
} |
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,42 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/ALT-F4-LLC/build-configs/internal/templates" | ||
) | ||
|
||
const TerraformModuleName = "terraform-module" | ||
|
||
type TerraformModuleConfig struct { | ||
Config | ||
Nix NixConfig `json:"nix,omitempty" yaml:"nix,omitempty"` | ||
Providers []string `json:"providers,omitempty" yaml:"providers,omitempty"` | ||
} | ||
|
||
func NewTerraformModuleConfig(c Config) TerraformModuleConfig { | ||
return TerraformModuleConfig{ | ||
Config: c, | ||
Nix: NewNixConfig(), | ||
} | ||
} | ||
|
||
func (c TerraformModuleConfig) Render() error { | ||
renderMap := templates.RenderMap{ | ||
templates.AllCommonTemplates: { | ||
".envrc", | ||
".github/renovate.json", | ||
}, | ||
templates.TerraformModuleTemplates: { | ||
".github/workflows/terraform.yaml", | ||
".gitignore", | ||
"flake.nix", | ||
"justfile", | ||
}, | ||
} | ||
|
||
files, err := templates.RenderTemplates(renderMap, c) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return templates.WriteFiles(files) | ||
} |
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
16 changes: 16 additions & 0 deletions
16
internal/templates/templates/common/all/.github__renovate.json
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,16 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base", | ||
":semanticCommitTypeAll(chore)" | ||
], | ||
"lockFileMaintenance": { | ||
"enabled": true, | ||
"extends": [ | ||
"schedule:weekly" | ||
] | ||
}, | ||
"nix": { | ||
"enabled": true | ||
} | ||
} |
Oops, something went wrong.