Skip to content

Commit b8ad577

Browse files
committed
Merge branch 'main' of https://github.com/kyma-project/busola into kyma-companion
2 parents 5aa7753 + 7c3642c commit b8ad577

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1066
-999
lines changed

.github/scripts/deploy_busola.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# This script install busola on k8s
4+
5+
# standard bash error handling
6+
set -o nounset # treat unset variables as an error and exit immediately.
7+
set -o errexit # exit immediately when a command fails.
8+
set -E # needs to be set if we want the ERR trap
9+
set -o pipefail # prevents errors in a pipeline from being masked
10+
11+
trap print_k8s_resources EXIT
12+
13+
print_k8s_resources()
14+
{
15+
kubectl get all
16+
kubectl get deployment -oyaml
17+
}
18+
19+
ENV=${ENV?"env is not set"}
20+
IMG_TAG=$1
21+
IMG_DIR=${IMG_DIR:-"dev"}
22+
23+
kubectl delete configmap environment --ignore-not-found=true
24+
kubectl create configmap environment --from-literal=ENVIRONMENT="${ENV}"
25+
echo "### Deploying busola from: ${IMG_DIR}/${IMG_TAG}"
26+
27+
cd resources
28+
(cd base && kustomize edit set image busola=europe-docker.pkg.dev/kyma-project/"${IMG_DIR}"/busola:"${IMG_TAG}")
29+
kustomize build base/ | kubectl apply -f-
30+
31+
kubectl apply -f ingress/ingress.yaml
32+
33+
# wait for busola to be deployed
34+
kubectl wait --for=condition=Available deployment/busola
35+
36+
# return ip address busola and save it to output
37+
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' ingress/busola
38+
IP=$(kubectl get ingress busola -ojson | jq .status.loadBalancer.ingress[].ip | tr -d '/"')
39+
echo "IP address: ${IP}"
40+
41+
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
42+
echo "IP=${IP}" >> "${GITHUB_OUTPUT}"
43+
echo "IP saved"
44+
fi;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# standard bash error handling
4+
set -o nounset # treat unset variables as an error and exit immediately.
5+
set -o errexit # exit immediately when a command fails.
6+
set -E # needs to be set if we want the ERR trap
7+
set -o pipefail # prevents errors in a pipeline from being masked
8+
9+
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml
10+
11+
#To access kubernetes cluster inside the same cluster change the api server address to url available inside the cluster.
12+
yq --inplace '.clusters[].cluster.server = "https://kubernetes.default.svc:443"' tests/integration/fixtures/kubeconfig.yaml

.github/scripts/upload_assets.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ BUSOLA_K8S="busola.yaml"
3535
generate_k8s() {
3636
set -x
3737
cd resources
38-
(cd base/web && kustomize edit set image busola-web=europe-docker.pkg.dev/kyma-project/prod/busola-web:"${RELEASE_TAG}")
39-
(cd base/backend && kustomize edit set image busola-backend=europe-docker.pkg.dev/kyma-project/prod/busola-backend:"${RELEASE_TAG}")
38+
(cd base && kustomize edit set image busola=europe-docker.pkg.dev/kyma-project/prod/busola:"${RELEASE_TAG}")
4039
kustomize build base/ > ../"${BUSOLA_K8S}"
4140
cd -
4241
}

.github/workflows/accessibility-tests.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ on:
1313
jobs:
1414
run-accessibility-tests:
1515
runs-on: ubuntu-latest
16+
if: github.event.pull_request.draft == false
1617
steps:
1718
- uses: actions/checkout@v4
18-
with:
19-
ref: ${{ github.event.pull_request.head.sha }}
20-
fetch-depth: 0
2119
- name: Install k3d
2220
env:
2321
K3D_URL: https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh
@@ -29,30 +27,17 @@ jobs:
2927
- uses: actions/setup-node@v4
3028
with:
3129
node-version: 20
32-
- name: setup_busola
30+
- name: Setup busola
3331
shell: bash
3432
run: |
35-
set -e
36-
npm ci
37-
npm run build
38-
npm i -g serve
39-
- name: run_tests
33+
.github/scripts/setup_local_busola.sh
34+
- name: Run tests
4035
shell: bash
4136
env:
4237
ACC_AMP_TOKEN: ${{ secrets.ACC_AMP_TOKEN }}
4338
run: |
4439
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml
45-
export CYPRESS_DOMAIN=http://localhost:3000
46-
serve -s build > busola.log &
47-
48-
pushd backend
49-
npm start > backend.log &
50-
popd
51-
52-
echo "waiting for server to be up..."
53-
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done
54-
sleep 10
55-
40+
export CYPRESS_DOMAIN=http://localhost:3001
5641
cd tests/integration
5742
npm ci && ACC_AMP_TOKEN=$ACC_AMP_TOKEN npm run "test:accesibility"
5843
- name: Uploads artifacts

.github/workflows/pull-integration-cluster-k3d.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
shell: bash
4444
run: |
4545
.github/scripts/setup_local_busola.sh
46-
- name: run_tests
46+
- name: Run tests
4747
shell: bash
4848
run: |
4949
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml

.github/workflows/pull-kyma-integration-tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ jobs:
3232
- uses: actions/setup-node@v4
3333
with:
3434
node-version: 20
35-
- name: Setup Busola
35+
- name: Deploy Busola
36+
id: deploy_busola
3637
shell: bash
37-
run: |
38-
.github/scripts/setup-busola.sh | tee busola-build.log
3938
env:
4039
ENV: dev
40+
run: |
41+
.github/scripts/deploy_busola.sh PR-${{ github.event.number }} | tee busola-deploy.log
42+
- name: Prepare kubeconfig
43+
run: |
44+
.github/scripts/prepare_kubeconfig.sh
4145
- name: Run tests
4246
shell: bash
4347
run: |
44-
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml
45-
export CYPRESS_DOMAIN=http://localhost:3001
46-
48+
export CYPRESS_DOMAIN=http://${{ steps.deploy_busola.outputs.IP }}
4749
cd tests/integration
4850
npm ci && npm run "test:kyma-e2e"
4951
- name: Uploads artifacts

.github/workflows/pull-smoke-test-stage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232
- uses: actions/setup-node@v4
3333
with:
3434
node-version: 20
35-
- name: setup_busola
35+
- name: Setup Busola
3636
shell: bash
3737
run: |
3838
./.github/scripts/setup-busola.sh | tee busola-build.log
3939
env:
4040
ENV: stage
41-
- name: run_tests
41+
- name: Run tests
4242
shell: bash
4343
run: |
4444
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ For the information on how to run tests and configure them, go to the [`tests`](
180180

181181
## Deploy Busola in the Kubernetes Cluster
182182

183-
To install Busola in the Kubernetes cluster, run:
183+
To install Busola from release in the Kubernetes cluster set `VERSION` shell environment variable with desired release and run:
184+
185+
```shell
186+
kubectl apply -f https://github.com/kyma-project/busola/releases/download/${VERSION}/busola.yaml
187+
```
188+
189+
To install Busola from main branch in the Kubernetes cluster, run:
184190

185191
```shell
186192
(cd resources && kustomize build base/ | kubectl apply -f- )

backend/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ if (gzipEnabled)
5151
);
5252

5353
if (process.env.NODE_ENV === 'development') {
54+
console.log('Use development settings of cors');
5455
app.use(cors({ origin: '*' }));
5556
}
5657

docs/extensibility/100-jsonata.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Use JSONata Expressions with Resource-Based Extensions
2+
3+
## Scoping
4+
5+
The primary data source of [JSONata](https://docs.jsonata.org/overview.html) expressions changes depending on where it's used. Starting with the root, it contains the whole resource, but whenever it's in a child whose parent has a **source** (in lists and details) or **path** (in forms) parameter, the scope changes to data from that source or path.
6+
7+
Additionally, the scope in arrays changes to the array item.
8+
9+
For example, for this resource:
10+
11+
```yaml
12+
spec:
13+
name: foo
14+
description: bar
15+
items:
16+
- name: item-name
17+
details:
18+
status: ok
19+
```
20+
21+
The following definition has their scope changed as follows:
22+
23+
```yaml
24+
- source: spec.name # top level, scope is the same as a resource
25+
26+
- source: spec # top level, scope is the same as a resource
27+
children:
28+
- source: name # parent has source=spec, therefore this refers to spec.name
29+
30+
- children:
31+
- source: spec.name # As there's no parent source here, the scope is still the resource
32+
33+
- source: spec.items
34+
children:
35+
- source: name # parent data is an array, therefore scope changes to its item - this refers to spec.items[0].name
36+
- source: details.status # refers to spec.items[0].details.status (same as above)
37+
- source: details # this changes scope for its children again
38+
children:
39+
source: status # this refers to spec.items[0].details.status
40+
```
41+
42+
## Common Variables
43+
44+
Common variables are the primary means to bypass the default scoping.
45+
46+
- **\$root** - always contains the reference to the resource, so any JSONata in the example above can always be `$root.spec.name`.
47+
- **\$item** - refers to the most recent array item. When not in an array, it's equal to **\$root**.
48+
- **\$items** - contains an array of references to all parent array items (with the last item being equal to **\$item**).
49+
- **\$value** - when used in a JSONata other than **source** (for example **visibility**, but also other widget-specific formulas), contains the value returned by the source.
50+
- **\$index** - exists in array components, refers to the index of the current item of an array.
51+
52+
### Example
53+
54+
```yaml
55+
- widget: Table
56+
source: spec.rules
57+
visibility: $exists($value)
58+
collapsibleTitle: "'Rule #' & $string($index + 1)"
59+
```
60+
61+
## Data Sources
62+
63+
Whenever data sources are provided, they are available as corresponding variable names. For more information, see [Configure the dataSources Section](90-datasources.md).

0 commit comments

Comments
 (0)