Skip to content

Commit

Permalink
adding all changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dilerous committed Jul 23, 2024
1 parent 0a766fc commit 8ca3074
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 10 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# .github/workflows/release.yml
name: goreleaser

on:
pull_request:
push:
# run only against tags
tags:
- "*"

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "${{ env.GITHUB_REF_NAME }}"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ logs.tar.gz
.gitignore
c.out
.DS_Store

dist/
42 changes: 42 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
binary: cnvrgctl

release:
prerelease: auto

universal_binaries:
- replace: true

brews:
-
name: cnvrgctl
homepage: https://github.com/dilerous/cnvrgctl
commit_author:
name: Brad Soper
email: [email protected]
28 changes: 18 additions & 10 deletions cmd/install/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Usage:
Examples:
# Install argocd into the argocd namespace with the default values.
cnvrgctl -n argocd install argocd
cnvrgctl -n argocd install argocd -n argocd
# Perform a dry run install of argocd.
cnvrgctl -n argocd install argocd --dry-run
Expand All @@ -41,7 +41,13 @@ Examples:
cnvrgctl -n argocd install argocd --repo https://github.com/argo-helm
# Install with a user specific domain.
cnvrgctl -n argocd install argocd -d argocd.dilerous.cloud`,
cnvrgctl -n argocd install argocd --domain argocd.dilerous.cloud
# Install with a tls enabled, the secret that will be used is argo-ui-tls.
cnvrgctl -n argocd install argocd -d argocd.dilerous.cloud --enable-tls
# Install with a tls enabled, and a cert-manager cluserIssuer defined.
cnvrgctl -n argocd install argocd -d argocd.dilerous.cloud --enable-tls --cluster-issuer letsencrypt-prod`,
Run: func(cmd *cobra.Command, args []string) {
log.Println("called the install argocd command function")

Expand Down Expand Up @@ -147,17 +153,11 @@ func createValues(f *root.Flags) (map[string]interface{}, error) {
},
}

// check if the enable-tls flag has been called
// check if the enable-tls flag has been set to true
if f.Tls {
// Update insecure to false
vals["configs"].(map[string]interface{})["params"].(map[string]interface{})["server"].(map[string]interface{})["insecure"] = false

//add in the annotation for clusterIssuer/issuer
newAnnotationKey := "cert-manager.io/cluster-issuer"
newAnnotationValue := f.ClusterIssuer

vals["server"].(map[string]interface{})["ingress"].(map[string]interface{})["annotations"].(map[string]interface{})[newAnnotationKey] = newAnnotationValue

// Create the TLS configuration
tls := []map[string]interface{}{
{
Expand All @@ -167,9 +167,17 @@ func createValues(f *root.Flags) (map[string]interface{}, error) {
},
},
}

// Add TLS to vals
vals["server"].(map[string]interface{})["ingress"].(map[string]interface{})["tls"] = tls
}

if f.ClusterIssuer != "" {
//add in the annotation for clusterIssuer/issuer
newAnnotationKey := "cert-manager.io/cluster-issuer"
newAnnotationValue := f.ClusterIssuer

//Add the annotation for cert-manager
vals["server"].(map[string]interface{})["ingress"].(map[string]interface{})["annotations"].(map[string]interface{})[newAnnotationKey] = newAnnotationValue
}
return vals, nil
}

0 comments on commit 8ca3074

Please sign in to comment.