Skip to content

Commit c7e1aa8

Browse files
author
Jacob Woffenden
authored
🐞 Fix bug in Cloud Platform's prompt (#17)
Signed-off-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk>
1 parent 892f65a commit c7e1aa8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

features/src/cloud-platform/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [Unreleased]
1010

11+
## [0.0.3] - 2024-02-01
12+
13+
### Changed
14+
15+
- Removed rogue `&&` from features/src/cloud-platform/src/home/vscode/.devcontainer/promptrc.d/cloud-platform.sh
16+
17+
- Updates logic in Cloud Platform prompt
18+
1119
## [0.0.2] - 2024-01-31
1220

1321
### Added

features/src/cloud-platform/devcontainer-feature.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "cloud-platform",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"name": "Cloud Platform",
55
"description": "Installs the Cloud Platform CLI",
66
"options": {

features/src/cloud-platform/src/home/vscode/.devcontainer/promptrc.d/cloud-platform.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ PROMPT+='`\
55
kubectlCurrentContext=$(kubectl config current-context 2>/dev/null); \
66
kubectlCurrentNamespace=$(kubectl config view --minify --output "jsonpath={..namespace}"); \
77
kubectlClientId=$(kubectl config view --output json | jq -r ".users[0].user[\"auth-provider\"].config[\"client-id\"]"); \
8-
kubectlServerVersion=$(kubectl version --output json 2>/dev/null | jq -r .serverVersion.gitVersion | sed "s/v//"); \
9-
&& if [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ "${kubectlClientId}" == "REPLACE_WITH_CLIENT_ID" ]]; then \
8+
kubectlServerVersion=$(kubectl version --output json 2>/dev/null | jq -r .serverVersion.gitVersion); \
9+
if [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ "${kubectlClientId}" == "REPLACE_WITH_CLIENT_ID" ]]; then \
1010
echo -n "[ cluster: %{$fg[yellow]%}${kubectlCurrentContext} (requires authentication)%{$reset_color%} ] "; \
11-
elif [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ ! -z "${kubectlServerVersion}" ]]; then \
11+
elif [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ "${kubectlClientId}" != "REPLACE_WITH_CLIENT_ID" ]] && [[ "${kubectlServerVersion}" != "null" ]]; then \
1212
echo -n "[ cluster: %{$fg[green]%}${kubectlCurrentContext} (authenticated)%{$reset_color%} ] "; \
13-
else
13+
elif [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ "${kubectlClientId}" != "REPLACE_WITH_CLIENT_ID" ]] && [[ "${kubectlServerVersion}" == "null" ]]; then
1414
echo -n "[ cluster: %{$fg[red]%}${kubectlCurrentContext} (issue with authentication)%{$reset_color%} ] "; \
1515
fi \
1616
&& if [[ "${kubectlCurrentContext}" == "cloud-platform-live" ]] && [[ ! -z "${kubectlCurrentNamespace}" ]] && [[ "${kubectlCurrentNamespace}" == *"-prod"* ]]; then \

0 commit comments

Comments
 (0)