Skip to content

Commit

Permalink
fix: use default cloud url (#5946)
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin authored Oct 21, 2024
1 parent 5db5371 commit d30799b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ jobs:
build_agent_image:
name: Build a Docker image for Testkube Agent
runs-on: ubuntu-latest
env:
TESTKUBE_CLOUD_URL: "agent.testkube.io:443"

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -163,6 +166,7 @@ jobs:
ga_id=${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_ID}}
ga_secret=${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_SECRET}}
docker_image_version=${{steps.tag.outputs.tag}}
cloud_url=${{ env.TESTKUBE_CLOUD_URL }}
context: build/kind
file: build/kind/kind.Dockerfile
platforms: linux/amd64,linux/arm64/v8
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
build_agent_image:
name: Build a Docker image for Testkube Agent
runs-on: ubuntu-latest
env:
TESTKUBE_CLOUD_URL: "agent.testkube.io:443"

steps:
- name: Checkout
Expand Down Expand Up @@ -155,6 +157,7 @@ jobs:
ga_id=${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_ID}}
ga_secret=${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_SECRET}}
docker_image_version=${{steps.tag.outputs.tag}}
cloud_url=${{ env.TESTKUBE_CLOUD_URL }}
context: build/kind
file: build/kind/kind.Dockerfile
platforms: linux/amd64,linux/arm64
Expand Down
7 changes: 0 additions & 7 deletions build/kind/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ if [ -z "$AGENT_KEY" ]; then
exit 1
fi

# Check if cloud url is provided
if [ -z "$CLOUD_URL" ]; then
log "Testkube installation failed. Please provide CLOUD_URL env var"
send_telenetry "docker_installation_failed" "parameter_not_found" "cloud url is empty"
exit 1
fi

# Step 1: Start docker service in background
/usr/local/bin/dockerd-entrypoint.sh &

Expand Down
2 changes: 2 additions & 0 deletions build/kind/kind.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ ARG ga_secret
ENV GA_SECRET=$ga_secret

Check warning on line 35 in build/kind/kind.Dockerfile

View workflow job for this annotation

GitHub Actions / Build a Docker image for Testkube Agent

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "GA_SECRET") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG docker_image_version
ENV DOCKER_IMAGE_VERSION=$docker_image_version
ARG cloud_url
ENV CLOUD_URL=$cloud_url

# Step 8: Set Docker entry point for DIND (Docker-in-Docker)
ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]
11 changes: 8 additions & 3 deletions cmd/kubectl-testkube/commands/common/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func CreateVariables(cmd *cobra.Command, ignoreSecretVariable bool) (vars map[st
return
}

func PopulateMasterFlags(cmd *cobra.Command, opts *HelmOptions, optionalIds bool) {
func PopulateMasterFlags(cmd *cobra.Command, opts *HelmOptions, isDockerCmd bool) {
var (
apiURIPrefix, uiURIPrefix, agentURIPrefix, cloudRootDomain, proRootDomain string
insecure bool
Expand All @@ -85,11 +85,16 @@ func PopulateMasterFlags(cmd *cobra.Command, opts *HelmOptions, optionalIds bool
cmd.Flags().StringVar(&opts.Master.UiUrlPrefix, "ui-prefix", defaultUiPrefix, "usually don't need to be changed [required for custom cloud mode]")
cmd.Flags().StringVar(&opts.Master.RootDomain, "root-domain", defaultRootDomain, "usually don't need to be changed [required for custom cloud mode]")

cmd.Flags().StringVar(&opts.Master.URIs.Agent, "agent-uri", "", "Testkube Pro agent URI [required for centralized mode]")
agentURI := ""
if isDockerCmd {
agentURI = "agent.testkube.io:443"
}

cmd.Flags().StringVar(&opts.Master.URIs.Agent, "agent-uri", agentURI, "Testkube Pro agent URI [required for centralized mode]")
cmd.Flags().StringVar(&opts.Master.URIs.Logs, "logs-uri", "", "Testkube Pro logs URI [required for centralized mode]")
cmd.Flags().StringVar(&opts.Master.AgentToken, "agent-token", "", "Testkube Pro agent key [required for centralized mode]")
neededForLogin := ""
if optionalIds {
if isDockerCmd {
neededForLogin = ". It can be skipped for no login mode"
}

Expand Down

0 comments on commit d30799b

Please sign in to comment.