Skip to content

Commit

Permalink
Generate script without escape characters and indentation (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrpinkas authored Feb 8, 2024
1 parent 62f23f8 commit 8997844
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions tas-installer/cmd/envgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"strings"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -39,25 +40,27 @@ func generateEnvVars() error {
echo "Base hostname = $BASE_HOSTNAME"
export KEYCLOAK_REALM=sigstore
export KEYCLOAK_URL=https://keycloak-keycloak-system.\` + baseHostname + `
export TUF_URL=https://tuf.\` + baseHostname + `
export COSIGN_FULCIO_URL=https://fulcio.\` + baseHostname + `
export COSIGN_REKOR_URL=https://rekor.\` + baseHostname + `
export COSIGN_MIRROR=\https://tuf.\` + baseHostname + `
export COSIGN_ROOT=\https://tuf.\` + baseHostname + `/root.json
export COSIGN_OIDC_ISSUER=\https://keycloak-keycloak-system.\` + baseHostname + `/auth/realms/\sigstore
export COSIGN_CERTIFICATE_OIDC_ISSUER=\https://keycloak-keycloak-system.\` + baseHostname + `/auth/realms/\sigstore
export KEYCLOAK_URL=https://keycloak-keycloak-system.` + baseHostname + `
export TUF_URL=https://tuf.` + baseHostname + `
export COSIGN_FULCIO_URL=https://fulcio.` + baseHostname + `
export COSIGN_REKOR_URL=https://rekor.` + baseHostname + `
export COSIGN_MIRROR=https://tuf.` + baseHostname + `
export COSIGN_ROOT=https://tuf.` + baseHostname + `/root.json
export COSIGN_OIDC_ISSUER=https://keycloak-keycloak-system.` + baseHostname + `/auth/realms/sigstore
export COSIGN_CERTIFICATE_OIDC_ISSUER=https://keycloak-keycloak-system.` + baseHostname + `/auth/realms/sigstore
export COSIGN_YES="true"
# Gitsign/Sigstore Variables
export SIGSTORE_FULCIO_URL=\https://fulcio.\` + baseHostname + `
export SIGSTORE_OIDC_ISSUER=\https://keycloak-keycloak-system.\` + baseHostname + `/auth/realms/\sigstore
export SIGSTORE_REKOR_URL=\https://rekor.\` + baseHostname + `
export SIGSTORE_FULCIO_URL=https://fulcio.` + baseHostname + `
export SIGSTORE_OIDC_ISSUER=https://keycloak-keycloak-system.` + baseHostname + `/auth/realms/sigstore
export SIGSTORE_REKOR_URL=https://rekor.` + baseHostname + `
# Rekor CLI Variables
export REKOR_REKOR_SERVER=\https://rekor.\` + baseHostname + `
export REKOR_REKOR_SERVER=https://rekor.` + baseHostname + `
`

scriptContent = strings.Replace(scriptContent, "\t\t", "", -1)
scriptContent = strings.TrimSpace(scriptContent)

fileName := "tas-env-variables.sh"
file, err := os.Create(fileName)
if err != nil {
Expand Down

0 comments on commit 8997844

Please sign in to comment.