Skip to content

Commit

Permalink
Fixes errant changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CGoodwin90 committed Jul 10, 2024
1 parent 7ee52d9 commit aaa9770
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 26 deletions.
53 changes: 33 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ api-tests: gen
# upstream
CI_BUILD_TAG ?= lagoon-cli
CORE_REPO=https://github.com/uselagoon/lagoon.git
CORE_TREEISH=main
CORE_TREEISH=make-export-refactoring

LAGOON_CORE_IMAGE_REPO=testlagoon
LAGOON_CORE_IMAGE_TAG=main

TEMP_CONFIG_FILE := temp_config.yaml

Expand All @@ -133,23 +136,33 @@ generate-config:
clean-config:
@rm -f $(TEMP_CONFIG_FILE)

# TODO - Update with UI-PR#266
.PHONY: test-with-api
test-with-api:
.PHONY: cli-tests-with-development-api
cli-tests-with-development-api: development-api
TOKEN=$$(docker run -e JWTSECRET=super-secret-string \
-e JWTAUDIENCE=api.dev \
-e JWTUSER=localadmin \
uselagoon/tests \
python3 /ansible/tasks/api/admin_token.py) \
&& $(MAKE) generate-config TOKEN=$$TOKEN \
&& $(MAKE) api-tests \
&& $(MAKE) clean-config \
&& $(MAKE) CI_BUILD_TAG=$(CI_BUILD_TAG) development-api-down

.PHONY: development-api
development-api:
export LAGOON_CORE=$$(mktemp -d ./lagoon-core.XXX) \
&& git clone $(CORE_REPO) "$$LAGOON_CORE" \
&& cd "$$LAGOON_CORE" \
&& git checkout $(CORE_TREEISH) \
&& TOKEN=$$(docker run -e JWTSECRET=super-secret-string \
-e JWTAUDIENCE=api.dev \
-e JWTUSER=localadmin \
uselagoon/tests \
python3 /ansible/tasks/api/admin_token.py) \
&& IMAGE_REPO=uselagoon docker compose -p $(CI_BUILD_TAG) --compatibility up -d api api-db actions-handler local-api-data-watcher-pusher keycloak keycloak-db broker api-redis logs2notifications local-minio mailhog \
&& $(MAKE) CI_BUILD_TAG=$(CI_BUILD_TAG) wait-for-keycloak \
&& cd .. \
&& $(MAKE) generate-config TOKEN=$$TOKEN \
&& $(MAKE) api-tests \
&& $(MAKE) clean-config \
&& cd "$$LAGOON_CORE" \
&& $(MAKE) CI_BUILD_TAG=$(CI_BUILD_TAG) down
&& git clone $(CORE_REPO) "$$LAGOON_CORE" \
&& cd "$$LAGOON_CORE" \
&& git checkout $(CORE_TREEISH) \
&& IMAGE_REPO=$(LAGOON_CORE_IMAGE_REPO) IMAGE_REPO_TAG=$(LAGOON_CORE_IMAGE_TAG) COMPOSE_STACK_NAME=core-$(CI_BUILD_TAG) docker compose -p core-$(CI_BUILD_TAG) pull \
&& IMAGE_REPO=$(LAGOON_CORE_IMAGE_REPO) IMAGE_REPO_TAG=$(LAGOON_CORE_IMAGE_TAG) COMPOSE_STACK_NAME=core-$(CI_BUILD_TAG) $(MAKE) compose-api-logs-development

.PHONY: development-api-down
development-api-down:
cd lagoon-core* && \
docker-compose -p core-$(CI_BUILD_TAG) --compatibility down -v --remove-orphans

.PHONY: down
down:
$(MAKE) development-api-down
docker-compose -p $(CI_BUILD_TAG) --compatibility down -v --remove-orphans
12 changes: 8 additions & 4 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ use 'lagoon deploy latest' instead`,
return err
}
resultData := output.Result{Result: result.DeployEnvironmentBranch}
output.RenderResult(resultData, outputOptions, cmd)
r := output.RenderResult(resultData, outputOptions)
fmt.Fprintf(cmd.OutOrStdout(), "%s", r)
}
return nil
},
Expand Down Expand Up @@ -146,7 +147,8 @@ var deployPromoteCmd = &cobra.Command{
return err
}
resultData := output.Result{Result: result.DeployEnvironmentPromote}
output.RenderResult(resultData, outputOptions, cmd)
r := output.RenderResult(resultData, outputOptions)
fmt.Fprintf(cmd.OutOrStdout(), "%s", r)
}
return nil
},
Expand Down Expand Up @@ -208,7 +210,8 @@ This environment should already exist in lagoon. It is analogous with the 'Deplo
return err
}
resultData := output.Result{Result: result.DeployEnvironmentLatest}
output.RenderResult(resultData, outputOptions, cmd)
r := output.RenderResult(resultData, outputOptions)
fmt.Fprintf(cmd.OutOrStdout(), "%s", r)
}
return nil
},
Expand Down Expand Up @@ -296,7 +299,8 @@ This pullrequest may not already exist as an environment in lagoon.`,
return err
}
resultData := output.Result{Result: result.DeployEnvironmentPullrequest}
output.RenderResult(resultData, outputOptions, cmd)
r := output.RenderResult(resultData, outputOptions)
fmt.Fprintf(cmd.OutOrStdout(), "%s", r)
}
return nil
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestAPIProjectCommands(t *testing.T) {
}{
{
name: "Add Project",
cmdArgs: []string{"add", "project", "--project=test-project", "--production-environment=main", "--openshift=4", "--git-url=https://github.com/lagoon-examples/drupal10-base"},
cmdArgs: []string{"add", "project", "--project=test-project", "--production-environment=main", "--deploytarget=4", "--git-url=https://github.com/lagoon-examples/drupal10-base"},
setupCmd: func(cmd *cobra.Command, flags pflag.FlagSet) {
cmd.AddCommand(addCmd)
addCmd.AddCommand(addProjectCmd)
Expand All @@ -31,7 +31,7 @@ func TestAPIProjectCommands(t *testing.T) {
},
{
name: "Add Project to an Organization",
cmdArgs: []string{"add", "project", "--project=test-organization-project", "--organization-name=lagoon-demo-organization", "--production-environment=main", "--openshift=4", "--git-url=https://github.com/lagoon-examples/drupal10-base"},
cmdArgs: []string{"add", "project", "--project=test-organization-project", "--organization-name=lagoon-demo-organization", "--production-environment=main", "--deploytarget=4", "--git-url=https://github.com/lagoon-examples/drupal10-base"},
setupCmd: func(cmd *cobra.Command, flags pflag.FlagSet) {
cmd.AddCommand(addCmd)
addCmd.AddCommand(addProjectCmd)
Expand Down
1 change: 1 addition & 0 deletions local-dev/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ lagoons:
hostname: "localhost"
port: "2020"
token: ${TOKEN}
version: v1.9.0

0 comments on commit aaa9770

Please sign in to comment.