Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v0.43.0 #37

Merged
merged 37 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
88ca527
#33 - test doc generate action
apanasiuk-el Jul 23, 2024
aac7438
#33 - test doc generate action with push commit
apanasiuk-el Jul 23, 2024
0fd1d78
Update commands documentation
invalid-email-address Jul 23, 2024
0a91d59
#33 - test doc generate action
apanasiuk-el Jul 23, 2024
d841585
Merge branch 'feature/RMK-33-implement-a-new-github-action-for-rmk-do…
apanasiuk-el Jul 23, 2024
e44af52
Update commands documentation
invalid-email-address Jul 23, 2024
ae0311f
#33 - add a new GitHub action for RMK commands documentation generate
apanasiuk-el Jul 23, 2024
d852639
#33 - refactoring
apanasiuk-el Jul 23, 2024
0084df6
Merge pull request #35 from edenlabllc/feature/RMK-33-implement-a-new…
apanasiuk-el Jul 23, 2024
9d5bf5d
#34 - add support Terraform outputs of boolean types
apanasiuk-el Jul 24, 2024
dc97212
#34 - refactoring
apanasiuk-el Jul 25, 2024
b3f447c
Merge pull request #36 from edenlabllc/feature/RMK-34-support-terrafo…
apanasiuk-el Jul 25, 2024
71ea03d
#33 - add additional permission for action
apanasiuk-el Jul 25, 2024
414d85d
Merge pull request #38 from edenlabllc/feature/RMK-33-implement-a-new…
apanasiuk-el Jul 25, 2024
5a7bce0
#33 - refactoring
apanasiuk-el Jul 25, 2024
6848223
Merge pull request #39 from edenlabllc/feature/RMK-33-implement-a-new…
apanasiuk-el Jul 25, 2024
bfb6b76
#33 - refactoring
apanasiuk-el Jul 25, 2024
14da62f
Merge branch 'develop' of github.com:edenlabllc/rmk into develop
apanasiuk-el Jul 25, 2024
bf4b5ae
Update commands documentation
invalid-email-address Jul 25, 2024
ceeb25a
Update commands documentation
invalid-email-address Jul 25, 2024
415251a
Update commands documentation
invalid-email-address Jul 25, 2024
a42810d
#33 - refactoring
apanasiuk-el Jul 25, 2024
79aa7e6
Update commands documentation
invalid-email-address Jul 25, 2024
cc811e0
Merge branch 'develop' of github.com:edenlabllc/rmk into develop
apanasiuk-el Jul 25, 2024
8d91a94
Update commands documentation
invalid-email-address Jul 25, 2024
de36cc7
Update commands documentation
invalid-email-address Jul 25, 2024
3a0d225
Update commands documentation
invalid-email-address Jul 25, 2024
274bb0a
Update commands documentation
invalid-email-address Jul 25, 2024
e23d8be
Update commands documentation
invalid-email-address Jul 25, 2024
d6aab0c
Update commands documentation
invalid-email-address Jul 25, 2024
3ffea9f
Update commands documentation
invalid-email-address Jul 25, 2024
2a71a5e
Update commands documentation
invalid-email-address Jul 25, 2024
5dff423
Update commands documentation
invalid-email-address Jul 25, 2024
13379d5
Update commands documentation
invalid-email-address Jul 25, 2024
2a08a28
Update commands documentation
invalid-email-address Jul 25, 2024
9b69c37
#33 - add [skip ci] to action commit message
apanasiuk-el Jul 25, 2024
9d85b2c
Merge branch 'develop' of github.com:edenlabllc/rmk into develop
apanasiuk-el Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/docs-commands-generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Generate commands documentation

on:
push:
branches:
- develop
- hotfix/*

jobs:
docs-commands-generate:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN_REPO_FULL_ACCESS }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21

- name: Run GoReleaser artifact build
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.23.0
args: build --clean --skip=validate

- name: Generate and commit new commands documentation
run: |
echo "Configure Git user.name and user.email."
git config user.name github-actions
git config user.email [email protected]

echo "Generate new commands documentation."
./dist/rmk_linux_amd64_v1/rmk doc generate > ./docs/commands.md

if (git commit --all --message="[skip ci] Update commands documentation"); then
git push
echo "The new commands documentation has been committed."
fi
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
GIT_COMMIT_MSG="$(git log -1 --pretty=format:"%s")"
echo "${GIT_COMMIT_MSG}"

if [[ ! "${GIT_COMMIT_MSG}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${GITHUB_ORG}/release/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
>&2 echo "Pushes to master should be done via merges of PR requests from release/vN.N.N branches only."
if [[ ! "${GIT_COMMIT_MSG}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${GITHUB_ORG}/(hotfix|release)/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
>&2 echo "Pushes to master should be done via merges of PR requests from hotfix/vN.N.N or release/vN.N.N branches only."
>&2 echo "The expected message format (will be used for parsing a release tag):"
>&2 echo "Merge pull request #N from edenlabllc/release/vN.N.N"
>&2 echo "Merge pull request #N from ${GITHUB_ORG}/hotfix/vN.N.N or ${GITHUB_ORG}/release/vN.N.N."
exit 1
fi

VERSION="${BASH_REMATCH[1]}"
VERSION="${BASH_REMATCH[2]}"
echo "DISABLE_BLOB_RMK_RC=true" >> "${GITHUB_ENV}"
}

Expand Down
2 changes: 1 addition & 1 deletion commands/container_registry_category.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (cr *CRCommands) dockerLogin() error {
}

if token, ok := credentials[cr.Conf.AWSECRUserName]; !ok {
return fmt.Errorf("failed to get token")
return fmt.Errorf("failed to get ECR token")
} else {
if cr.Ctx.Bool("get-token") {
fmt.Println(token)
Expand Down
10 changes: 5 additions & 5 deletions commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ func flagsConfigList() []cli.Flag {
func flagsClusterK3DCreate() []cli.Flag {
return append(flagsHidden(),
&cli.StringFlag{
Name: "k3d-volume-host-path",
Usage: "host local directory path for mount into K3D cluster",
Aliases: []string{"kv"},
EnvVars: []string{"RMK_K3D_VOLUME_HOST_PATH"},
Value: system.GetPwdPath(""),
Name: "k3d-volume-host-path",
Usage: "host local directory path for mount into K3D cluster",
Aliases: []string{"kv"},
EnvVars: []string{"RMK_K3D_VOLUME_HOST_PATH"},
DefaultText: "present working directory",
},
)
}
Expand Down
20 changes: 13 additions & 7 deletions commands/k3d_category.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,21 @@ func (k *K3DCommands) prepareK3D(args ...string) error {
return err
}

for key, val := range credentials {
k.SpecCMD.Envs = append(k.SpecCMD.Envs,
"K3D_NAME="+k.Conf.Name,
"K3D_VOLUME_HOST_PATH="+k.Ctx.String("k3d-volume-host-path"),
"K3D_AWS_ECR_USER="+key,
"K3D_AWS_ECR_PASSWORD="+val,
)
k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_NAME="+k.Conf.Name)

if token, ok := credentials[k.Conf.AWSECRUserName]; !ok {
return fmt.Errorf("failed to get ECR token")
} else {
k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_AWS_ECR_USER="+k.Conf.AWSECRUserName, "K3D_AWS_ECR_PASSWORD="+token)
}

if len(k.Ctx.String("k3d-volume-host-path")) > 0 {
k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_VOLUME_HOST_PATH="+k.Ctx.String("k3d-volume-host-path"))
return nil
}

k.SpecCMD.Envs = append(k.SpecCMD.Envs, "K3D_VOLUME_HOST_PATH="+system.GetPwdPath(""))

return nil
}

Expand Down
27 changes: 17 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"
"text/template"

Expand Down Expand Up @@ -51,8 +52,8 @@ type Config struct {
}

type ExportedVars struct {
TerraformOutput map[string]string `yaml:"terraform-output,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
TerraformOutput map[string]interface{} `yaml:"terraform-output,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
}

type HookMapping struct {
Expand Down Expand Up @@ -117,7 +118,7 @@ func (conf *Config) InitConfig(terraformOutput bool) *Config {
}

conf.ExportedVars = ExportedVars{
TerraformOutput: make(map[string]string),
TerraformOutput: make(map[string]interface{}),
Env: make(map[string]string),
}

Expand Down Expand Up @@ -165,8 +166,8 @@ func (conf *Config) GetConfigs(all bool) error {
func (conf *Config) SetRootDomain(c *cli.Context, gitSpecID string) error {
hostedZoneVar := system.TerraformVarsPrefix + system.TerraformVarHostedZoneName
if !c.IsSet("root-domain") {
if hostedZoneName, ok := conf.TerraformOutput[hostedZoneVar]; ok && len(hostedZoneName) > 0 {
if err := c.Set("root-domain", hostedZoneName); err != nil {
if hostedZoneName, ok := conf.TerraformOutput[hostedZoneVar]; ok && len(hostedZoneName.(string)) > 0 {
if err := c.Set("root-domain", hostedZoneName.(string)); err != nil {
return err
}
} else {
Expand Down Expand Up @@ -225,12 +226,18 @@ func (conf *Config) GetTerraformOutputs() error {
return err
}

if reflect.TypeOf(getVar.Type).Kind() == reflect.String {
conf.TerraformOutput[key] = getVar.Value.(string)
conf.Env[strings.ToUpper(strings.ReplaceAll(key, system.TerraformVarsPrefix, ""))] = getVar.Value.(string)
} else {
envKey := strings.ToUpper(strings.ReplaceAll(key, system.TerraformVarsPrefix, ""))

switch {
case reflect.TypeOf(getVar.Value).Kind() == reflect.String && getVar.Type == reflect.String.String():
conf.TerraformOutput[key] = getVar.Value
conf.Env[envKey] = getVar.Value.(string)
case reflect.TypeOf(getVar.Value).Kind() == reflect.Bool && getVar.Type == reflect.Bool.String():
conf.TerraformOutput[key] = getVar.Value
conf.Env[envKey] = strconv.FormatBool(getVar.Value.(bool))
default:
zap.S().Warnf("Terraform output variable %s will not be exported as environment variable, "+
"does not match the string type, current type: %s", key, getVar.Type)
"does not match string or boolean types, current type: %s", key, getVar.Type)
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ rmk

Command line tool for reduced management of the provision of Kubernetes clusters in different environments and management of service releases.
BuiltBy: goreleaser
Commit: fef9dcc
Date: 2024-05-09T07:30:00Z
Target: darwin_amd64
Commit: 13379d5
Date: 2024-07-25T14:53:34Z
Target: linux_amd64

**Usage**:

Expand Down Expand Up @@ -74,7 +74,7 @@ K3D cluster management

Create K3D cluster

**--k3d-volume-host-path, --kv**="": host local directory path for mount into K3D cluster (default: "${PWD}/rmk.tools.infra")
**--k3d-volume-host-path, --kv**="": host local directory path for mount into K3D cluster (default: present working directory)

#### delete, d

Expand Down Expand Up @@ -405,3 +405,4 @@ Update RMK CLI to a new version
## help, h

Shows a list of commands or help for one command

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exported-vars:

The variables listed in the `env` section will be used when running the `rmk release ...` commands.

> Only the `string` output variables are supported.
> Only the `string` or `boolean` types output variables are supported.

## Default exported variables

Expand Down
5 changes: 2 additions & 3 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
- #18 - Fixed links to the OSS repository in project generation.
- #18 - Split the issue template into the bug and feature templates.
- #18 - Updated the Roadmap section of README.md.
- #33 - Added a new GitHub action for RMK commands documentation generation.
- #34 - Added support for Terraform outputs of a boolean type.
Loading