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

fix: argo ci #2252

Closed
wants to merge 87 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
a0e7b89
chore: progress quit
CristhianF7 Jul 31, 2024
b15fe8e
chore: bubbletea blacklist ci flag
CristhianF7 Jul 31, 2024
6e62e58
chore: add flag
CristhianF7 Jul 31, 2024
27be85a
chore: error handling
CristhianF7 Jul 31, 2024
3b0d485
fix: bypass bubbletea execution
CristhianF7 Jul 31, 2024
98d91f7
fix: remove ssh host validation
CristhianF7 Jul 31, 2024
04e7acb
fix: status
CristhianF7 Jul 31, 2024
ad6f926
chore: print cluster name
CristhianF7 Aug 1, 2024
fc550b6
chore: test cluster name
CristhianF7 Aug 2, 2024
fb8a109
chore: test without provisioning
CristhianF7 Aug 2, 2024
e7ab4cc
chore: test without provisioning
CristhianF7 Aug 2, 2024
c399806
feat: cluster name for root-credentials
CristhianF7 Aug 4, 2024
c3c4468
chore: rollback provision
CristhianF7 Aug 5, 2024
97c647e
fix: return error when status has error
CristhianF7 Aug 5, 2024
012c395
fix: add cloudflare origin issuer
CristhianF7 Aug 12, 2024
f9ead3a
fix: fulldomain
CristhianF7 Aug 26, 2024
a87700b
pull in latest main of kubefirst
jarededwards Sep 1, 2024
e776e46
fix package ref for kubefirst
jarededwards Sep 1, 2024
42227f8
Merge branch 'main' of github.com:konstructio/kubefirst into fix-argo-ci
CristhianF7 Sep 3, 2024
3f5a366
Remove unused functions. Bump to Go 1.23. Run `gofmt` on all files.
patrickdappollonio Sep 3, 2024
38a1cbc
Change version on CI too
patrickdappollonio Sep 3, 2024
b90efb2
Add missing formatted file.
patrickdappollonio Sep 3, 2024
d39c93a
set next macro chart for kubefirst - 2.5.12-rc4
konstruct-bot Sep 4, 2024
e60e222
set next macro chart for kubefirst - 2.5.12-rc5
konstruct-bot Sep 4, 2024
6ac3396
set next macro chart for kubefirst - 2.5.12-rc7
konstruct-bot Sep 5, 2024
a907da9
set next macro chart for kubefirst - 2.5.12-rc6
konstruct-bot Sep 5, 2024
fb1d2c9
set next macro chart for kubefirst - 2.5.12-rc8
konstruct-bot Sep 5, 2024
1623657
set next macro chart for kubefirst - 2.5.12-rc9
konstruct-bot Sep 5, 2024
bb33b97
set next macro chart for kubefirst - 2.5.12-rc10
konstruct-bot Sep 5, 2024
db04e65
set next macro chart for kubefirst - 2.5.12-rc11
konstruct-bot Sep 5, 2024
5e6079d
set next macro chart for kubefirst - 2.5.12-rc12
konstruct-bot Sep 5, 2024
fa36bb2
set next macro chart for kubefirst - 2.5.12-rc13
konstruct-bot Sep 5, 2024
14b3427
set next macro chart for kubefirst - 2.5.12-rc14
konstruct-bot Sep 5, 2024
ea4c925
set next macro chart for kubefirst - 2.6.0
konstruct-bot Sep 5, 2024
f6d92ad
chore: bubbletea blacklist ci flag
CristhianF7 Jul 31, 2024
95efc98
chore: error handling
CristhianF7 Jul 31, 2024
0b4dc49
rebase
simple-noob-1 Sep 5, 2024
7dff4e1
chore: test without provisioning
CristhianF7 Aug 2, 2024
ab4195f
chore: rollback provision
CristhianF7 Aug 5, 2024
e650dcf
fix: return error when status has error
CristhianF7 Aug 5, 2024
010a8ca
fix:missing ref
simple-noob-1 Sep 5, 2024
a25c889
add ci for version and launch delete
simple-noob-1 Sep 7, 2024
c07272a
fix:delete cluster
jokestax Sep 7, 2024
a6d4eb1
add ci flag for launch
jokestax Sep 7, 2024
a1313b6
Remove unused functions. Bump to Go 1.23. Run `gofmt` on all files.
patrickdappollonio Sep 3, 2024
186cd1e
set next macro chart for kubefirst - 2.6.1-rc1
konstruct-bot Sep 9, 2024
dce245f
set next macro chart for kubefirst - 2.6.1-rc2
konstruct-bot Sep 9, 2024
c34e116
set next macro chart for kubefirst - 2.6.1
konstruct-bot Sep 9, 2024
c7765d1
fix reset cmd
jokestax Sep 16, 2024
e82b859
handle nil in switch
jokestax Sep 16, 2024
a71d960
use progress success function
jokestax Sep 16, 2024
7708c4c
fix(google): fix typo (#2285)
mrsimonemms Sep 17, 2024
e518958
Clean up code using GolangCI-Lint
patrickdappollonio Sep 3, 2024
48d7bd1
Enable golangci-lint
patrickdappollonio Sep 3, 2024
f9f773b
Fix version printing.
patrickdappollonio Sep 3, 2024
6005b8a
Cleanup internal folder
patrickdappollonio Sep 3, 2024
c9b6905
Fix compilation
patrickdappollonio Sep 3, 2024
97caaf4
Update using final standard linters
patrickdappollonio Sep 3, 2024
7dd646e
Fix typo in function name.
patrickdappollonio Sep 17, 2024
a7f98c0
Fixes to error handling.
patrickdappollonio Sep 18, 2024
cb1016f
set next macro chart for kubefirst - 2.6.2-rc1
konstruct-bot Sep 18, 2024
d2e70ee
chore: bubbletea blacklist ci flag
CristhianF7 Jul 31, 2024
d5f4844
chore: error handling
CristhianF7 Jul 31, 2024
f73bf76
fix: bypass bubbletea execution
CristhianF7 Jul 31, 2024
cee5cd3
chore: print cluster name
CristhianF7 Aug 1, 2024
6859ded
chore: test cluster name
CristhianF7 Aug 2, 2024
32b569a
chore: test without provisioning
CristhianF7 Aug 2, 2024
e43cf15
chore: bubbletea blacklist ci flag
CristhianF7 Jul 31, 2024
3895309
rebase
simple-noob-1 Sep 5, 2024
7d158ab
chore: test without provisioning
CristhianF7 Aug 2, 2024
cd95b7f
chore: rollback provision
CristhianF7 Aug 5, 2024
a93ef04
Clean up code using GolangCI-Lint
patrickdappollonio Sep 3, 2024
1c1d84f
Fix version printing.
patrickdappollonio Sep 3, 2024
c988184
Cleanup internal folder
patrickdappollonio Sep 3, 2024
8831cf2
Update using final standard linters
patrickdappollonio Sep 3, 2024
1d6e0b5
chore: bubbletea blacklist ci flag
CristhianF7 Jul 31, 2024
04ed9e2
chore: error handling
CristhianF7 Jul 31, 2024
c30101c
fix: bypass bubbletea execution
CristhianF7 Jul 31, 2024
04ad3e1
chore: print cluster name
CristhianF7 Aug 1, 2024
55dddf7
chore: bubbletea blacklist ci flag
CristhianF7 Jul 31, 2024
dd5dd3f
rebase
simple-noob-1 Sep 5, 2024
ff9681d
Remove unused functions. Bump to Go 1.23. Run `gofmt` on all files.
patrickdappollonio Sep 3, 2024
c1c3a1f
Clean up code using GolangCI-Lint
patrickdappollonio Sep 3, 2024
48fb8b7
Cleanup internal folder
patrickdappollonio Sep 3, 2024
00b8bdd
Update using final standard linters
patrickdappollonio Sep 3, 2024
e854a66
chore: print cluster name
CristhianF7 Aug 1, 2024
6e1a184
minor changes
jokestax Sep 18, 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
10 changes: 7 additions & 3 deletions .github/workflows/check-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Running Golang tests
run: go test -v -short ./...
go-version-file: go.mod
- name: Run GolangCI-Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60.3
- name: Test application
run: go test -short -v ./...
8 changes: 4 additions & 4 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '>=1.18.0'
go-version-file: go.mod

-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
Expand All @@ -40,4 +40,4 @@ jobs:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
121 changes: 121 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
run:
tests: false
concurrency: 5
timeout: 5m

linters:
disable-all: true
enable:
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- errchkjson
- errname
- errorlint
- exhaustive
- copyloopvar
- ginkgolinter
- gocheckcompilerdirectives
- gochecksumtype
- gocritic
- gocyclo
- gofmt
- gofumpt
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- grouper
- importas
- inamedparam
- interfacebloat
- ireturn
- loggercheck
- makezero
- mirror
- misspell
- nakedret
- nilerr
- nilnil
- nonamedreturns
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- stylecheck
- tenv
- testableexamples
- testifylint
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
- wastedassign
- whitespace
- wrapcheck
- zerologlint

linters-settings:
perfsprint:
int-conversion: false
err-error: false
errorf: true
sprintf1: true
strconcat: false

ireturn:
allow:
- anon
- error
- empty
- stdlib
- ssh.PublicKey
- tea.Model

gosec:
confidence: medium
excludes:
- G107 # Potential HTTP request made with variable url: these are often false positives or intentional
- G110 # Decompression bombs: we can check these manually when submitting code
- G306 # Poor file permissions used when creating a directory: we can check these manually when submitting code
- G404 # Use of weak random number generator (math/rand instead of crypto/rand): we can live with these

stylecheck:
checks:
- "all"
- "-ST1003" # this is covered by a different linter

gocyclo:
min-complexity: 60

exhaustive:
check-generated: false
explicit-exhaustive-switch: false
explicit-exhaustive-map: false
default-case-required: false
default-signifies-exhaustive: true
package-scope-only: false
12 changes: 12 additions & 0 deletions Dockerfile-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM debian:latest

# Installing dependencies
RUN apt-get update && apt-get install -y \
build-essential \
coreutils \
curl \
file \
git \
&& rm -rf /var/lib/apt/lists/*

CMD [ "/bin/bash" ]
10 changes: 5 additions & 5 deletions cmd/akamai/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewCommand() *cobra.Command {
Use: "akamai",
Short: "kubefirst akamai installation",
Long: "kubefirst akamai",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Println("To learn more about akamai in kubefirst, run:")
fmt.Println(" kubefirst beta akamai --help")

Expand Down Expand Up @@ -89,12 +89,12 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&clusterTypeFlag, "cluster-type", "mgmt", "the type of cluster to create (i.e. mgmt|workload)")
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", akamaiDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", akamaiDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "cloudflare", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "cloudflare", fmt.Sprintf("the dns provider - one of: %q", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "https", fmt.Sprintf("the git protocol - one of: %s", supportedGitProtocolOverride))
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %q", supportedGitProviders))
createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "https", fmt.Sprintf("the git protocol - one of: %q", supportedGitProtocolOverride))
createCmd.Flags().StringVar(&githubOrgFlag, "github-org", "", "the GitHub organization for the new gitops and metaphor repositories - required if using github")
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
Expand All @@ -112,7 +112,6 @@ func Destroy() *cobra.Command {
Short: "destroy the kubefirst platform",
Long: "destroy the kubefirst platform running in akamai and remove all resources",
RunE: common.Destroy,
// PreRun: common.CheckDocker,
}

return destroyCmd
Expand All @@ -126,6 +125,7 @@ func RootCredentials() *cobra.Command {
RunE: common.GetRootCredentials,
}

authCmd.Flags().BoolVar(&ciFlag, "ci", false, "if running kubefirst in ci, set this flag to disable interactive features")
authCmd.Flags().BoolVar(&copyArgoCDPasswordToClipboardFlag, "argocd", false, "copy the argocd password to the clipboard (optional)")
authCmd.Flags().BoolVar(&copyKbotPasswordToClipboardFlag, "kbot", false, "copy the kbot password to the clipboard (optional)")
authCmd.Flags().BoolVar(&copyVaultPasswordToClipboardFlag, "vault", false, "copy the vault password to the clipboard (optional)")
Expand Down
39 changes: 21 additions & 18 deletions cmd/akamai/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,34 @@ import (
"github.com/spf13/viper"
)

func createAkamai(cmd *cobra.Command, args []string) error {
func createAkamai(cmd *cobra.Command, _ []string) error {
cliFlags, err := utilities.GetFlags(cmd, "akamai")
if err != nil {
progress.Error(err.Error())
return nil
return fmt.Errorf("failed to get flags: %w", err)
}

progress.DisplayLogHints(25)

isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps)
if !isValid {
return err
return fmt.Errorf("catalog validation failed: %w", err)
}

err = ValidateProvidedFlags(cliFlags.GitProvider)
if err != nil {
progress.Error(err.Error())
return nil
return fmt.Errorf("failed to validate provided flags: %w", err)
}

// If cluster setup is complete, return

utilities.CreateK1ClusterDirectory(clusterNameFlag)

gitAuth, err := gitShim.ValidateGitCredentials(cliFlags.GitProvider, cliFlags.GithubOrg, cliFlags.GitlabGroup)
if err != nil {
progress.Error(err.Error())
return nil
return fmt.Errorf("failed to validate git credentials: %w", err)
}

// Validate git
executionControl := viper.GetBool(fmt.Sprintf("kubefirst-checks.%s-credentials", cliFlags.GitProvider))
if !executionControl {
newRepositoryNames := []string{"gitops", "metaphor"}
Expand All @@ -72,11 +69,13 @@ func createAkamai(cmd *cobra.Command, args []string) error {
err = gitShim.InitializeGitProvider(&initGitParameters)
if err != nil {
progress.Error(err.Error())
return nil
return fmt.Errorf("failed to initialize git provider: %w", err)
}
}
viper.Set(fmt.Sprintf("kubefirst-checks.%s-credentials", cliFlags.GitProvider), true)
viper.WriteConfig()
if err := viper.WriteConfig(); err != nil {
return fmt.Errorf("failed to write viper config: %w", err)
}

k3dClusterCreationComplete := viper.GetBool("launch.deployed")
isK1Debug := strings.ToLower(os.Getenv("K1_LOCAL_DEBUG")) == "true"
Expand All @@ -85,12 +84,16 @@ func createAkamai(cmd *cobra.Command, args []string) error {
launch.Up(nil, true, cliFlags.UseTelemetry)
}

err = pkg.IsAppAvailable(fmt.Sprintf("%s/api/proxyHealth", cluster.GetConsoleIngresUrl()), "kubefirst api")
err = pkg.IsAppAvailable(fmt.Sprintf("%s/api/proxyHealth", cluster.GetConsoleIngressURL()), "kubefirst api")
if err != nil {
progress.Error("unable to start kubefirst api")
return fmt.Errorf("failed to check kubefirst api availability: %w", err)
}

provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps)
if err := provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps); err != nil {
progress.Error(err.Error())
return fmt.Errorf("failed to create management cluster: %w", err)
}

return nil
}
Expand All @@ -99,11 +102,9 @@ func ValidateProvidedFlags(gitProvider string) error {
progress.AddStep("Validate provided flags")

if os.Getenv("LINODE_TOKEN") == "" {
// telemetryShim.Transmit(useTelemetryFlag, segmentClient, segment.MetricCloudCredentialsCheckFailed, "LINODE_TOKEN environment variable was not set")
return fmt.Errorf("your LINODE_TOKEN is not set - please set and re-run your last command")
}

// Validate required environment variables for dns provider
if dnsProviderFlag == "cloudflare" {
if os.Getenv("CF_API_TOKEN") == "" {
return fmt.Errorf("your CF_API_TOKEN environment variable is not set. Please set and try again")
Expand All @@ -114,17 +115,19 @@ func ValidateProvidedFlags(gitProvider string) error {
case "github":
key, err := internalssh.GetHostKey("github.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy: %w", err)
} else {
log.Info().Msgf("%s %s\n", "github.com", key.Type())
log.Info().Msgf("%q %s", "github.com", key.Type())
}
log.Info().Msgf("%q %s", "github.com", key.Type())
case "gitlab":
key, err := internalssh.GetHostKey("gitlab.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy: %w", err)
} else {
log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
log.Info().Msgf("%q %s", "gitlab.com", key.Type())
}
log.Info().Msgf("%q %s", "gitlab.com", key.Type())
}

progress.CompleteStep("Validate provided flags")
Expand Down
10 changes: 6 additions & 4 deletions cmd/aws/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewCommand() *cobra.Command {
Use: "aws",
Short: "kubefirst aws installation",
Long: "kubefirst aws",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Println("To learn more about aws in kubefirst, run:")
fmt.Println(" kubefirst help")

Expand Down Expand Up @@ -85,12 +85,12 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&clusterTypeFlag, "cluster-type", "mgmt", "the type of cluster to create (i.e. mgmt|workload)")
createCmd.Flags().StringVar(&nodeCountFlag, "node-count", awsDefaults.NodeCount, "the node count for the cluster")
createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", awsDefaults.InstanceSize, "the instance size of the cluster to create")
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "aws", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders))
createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "aws", fmt.Sprintf("the dns provider - one of: %q", supportedDNSProviders))
createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)")
createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the Route53/Cloudflare hosted zone name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)")
createCmd.MarkFlagRequired("domain-name")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "ssh", fmt.Sprintf("the git protocol - one of: %s", supportedGitProtocolOverride))
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %q", supportedGitProviders))
createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "ssh", fmt.Sprintf("the git protocol - one of: %q", supportedGitProtocolOverride))
createCmd.Flags().StringVar(&githubOrgFlag, "github-org", "", "the GitHub organization for the new gitops and metaphor repositories - required if using github")
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
Expand Down Expand Up @@ -136,5 +136,7 @@ func RootCredentials() *cobra.Command {
RunE: common.GetRootCredentials,
}

authCmd.Flags().BoolVar(&ciFlag, "ci", false, "if running kubefirst in ci, set this flag to disable interactive features")

return authCmd
}
Loading
Loading