@rancher/shell 0.3.11 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/assets/translations/en-us.yaml +51 -5
  2. package/chart/monitoring/StorageClassSelector.vue +1 -0
  3. package/chart/monitoring/index.vue +4 -0
  4. package/chart/monitoring/prometheus/index.vue +6 -3
  5. package/components/ActionMenu.vue +1 -1
  6. package/components/DetailTop.vue +0 -2
  7. package/components/ExplorerMembers.vue +22 -10
  8. package/components/ExplorerProjectsNamespaces.vue +1 -0
  9. package/components/GrafanaDashboard.vue +2 -2
  10. package/components/Inactivity.vue +1 -0
  11. package/components/ModalWithCard.vue +1 -0
  12. package/components/Tabbed/index.vue +2 -0
  13. package/components/Wizard.vue +4 -3
  14. package/components/form/KeyValue.vue +12 -7
  15. package/components/form/NodeAffinity.vue +29 -7
  16. package/components/form/PodAffinity.vue +27 -7
  17. package/components/form/Taints.vue +6 -0
  18. package/components/formatter/ExtensionCache.vue +74 -0
  19. package/components/nav/Header.vue +1 -0
  20. package/components/nav/WindowManager/ContainerShell.vue +10 -0
  21. package/components/nav/WindowManager/index.vue +1 -0
  22. package/config/product/explorer.js +1 -10
  23. package/config/product/monitoring.js +2 -1
  24. package/config/router.js +3 -3
  25. package/config/table-headers.js +32 -24
  26. package/config/uiplugins.js +11 -0
  27. package/config/workload.ts +1 -0
  28. package/core/types.ts +25 -7
  29. package/creators/pkg/files/.github/workflows/build-container.yml +64 -0
  30. package/creators/pkg/init +13 -6
  31. package/detail/node.vue +2 -2
  32. package/detail/workload/index.vue +1 -1
  33. package/edit/__tests__/management.cattle.io.setting.test.ts +1 -1
  34. package/edit/autoscaling.horizontalpodautoscaler/metric-target.vue +0 -2
  35. package/edit/logging.banzaicloud.io.output/__tests__/logging.banzaicloud.io.output.test.ts +43 -0
  36. package/edit/logging.banzaicloud.io.output/index.vue +8 -5
  37. package/edit/logging.banzaicloud.io.output/providers/__tests__/loki.test.ts +13 -0
  38. package/edit/logging.banzaicloud.io.output/providers/loki.vue +1 -0
  39. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +0 -2
  40. package/edit/monitoring.coreos.com.receiver/index.vue +32 -1
  41. package/edit/monitoring.coreos.com.receiver/types/email.vue +12 -4
  42. package/edit/namespace.vue +1 -0
  43. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +36 -6
  44. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +2 -2
  45. package/edit/provisioning.cattle.io.cluster/rke2.vue +58 -13
  46. package/middleware/authenticated.js +1 -0
  47. package/models/__tests__/batch.cronjob.test.ts +88 -0
  48. package/models/cluster/node.js +8 -0
  49. package/models/management.cattle.io.clusterroletemplatebinding.js +5 -1
  50. package/models/projectroletemplatebinding.js +9 -1
  51. package/models/workload.js +1 -1
  52. package/package.json +1 -1
  53. package/pages/__tests__/prefs.test.ts +96 -0
  54. package/pages/auth/setup.vue +13 -13
  55. package/pages/c/_cluster/apps/charts/chart.vue +1 -1
  56. package/pages/c/_cluster/apps/charts/install.vue +5 -2
  57. package/pages/c/_cluster/monitoring/index.vue +10 -5
  58. package/pages/c/_cluster/settings/performance.vue +2 -0
  59. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +601 -0
  60. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +183 -0
  61. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +50 -9
  62. package/pages/c/_cluster/uiplugins/index.vue +329 -224
  63. package/pages/fail-whale.vue +1 -1
  64. package/pages/home.vue +11 -0
  65. package/pages/prefs.vue +20 -1
  66. package/plugins/plugin.js +1 -1
  67. package/public/index.html +6 -1
  68. package/rancher-components/components/Card/Card.vue +1 -0
  69. package/rancher-components/components/Form/Radio/RadioGroup.vue +1 -0
  70. package/scripts/extension/bundle +20 -4
  71. package/scripts/extension/helm/charts/ui-plugin-server/.helmignore +23 -0
  72. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +20 -0
  73. package/scripts/extension/helm/charts/ui-plugin-server/templates/_helpers.tpl +52 -0
  74. package/scripts/extension/helm/charts/ui-plugin-server/templates/cr.yaml +12 -0
  75. package/scripts/extension/helm/charts/ui-plugin-server/values.yaml +6 -0
  76. package/scripts/extension/helm/package/Dockerfile +27 -0
  77. package/scripts/extension/helm/package/nginx.conf +17 -0
  78. package/scripts/extension/helm/scripts/package +23 -0
  79. package/scripts/extension/helm/scripts/patch +101 -0
  80. package/scripts/extension/helm/scripts/version +31 -0
  81. package/scripts/extension/helmpatch +3 -25
  82. package/scripts/extension/publish +47 -32
  83. package/types/shell/index.d.ts +30 -24
  84. package/utils/__tests__/grafana.test.ts +2 -2
  85. package/utils/error.js +11 -0
  86. package/utils/grafana.js +5 -4
  87. package/vue.config.js +3 -17
@@ -35,7 +35,7 @@ export default {
35
35
  },
36
36
 
37
37
  displayError() {
38
- return stringify(this.error);
38
+ return this.error?.data ? this.error.data : stringify(this.error);
39
39
  },
40
40
  },
41
41
 
package/pages/home.vue CHANGED
@@ -53,6 +53,15 @@ export default {
53
53
  if ( this.$store.getters['management/canList'](MANAGEMENT.NODE) ) {
54
54
  this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE });
55
55
  }
56
+
57
+ // We need to fetch node pools and node templates in order to correctly show the provider for RKE1 clusters
58
+ if ( this.$store.getters['management/canList'](MANAGEMENT.NODE_POOL) ) {
59
+ this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE_POOL });
60
+ }
61
+
62
+ if ( this.$store.getters['management/canList'](MANAGEMENT.NODE_TEMPLATE) ) {
63
+ this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE_TEMPLATE });
64
+ }
56
65
  },
57
66
 
58
67
  data() {
@@ -211,6 +220,8 @@ export default {
211
220
  beforeDestroy() {
212
221
  this.$store.dispatch('management/forgetType', CAPI.MACHINE);
213
222
  this.$store.dispatch('management/forgetType', MANAGEMENT.NODE);
223
+ this.$store.dispatch('management/forgetType', MANAGEMENT.NODE_POOL);
224
+ this.$store.dispatch('management/forgetType', MANAGEMENT.NODE_TEMPLATE);
214
225
  },
215
226
 
216
227
  methods: {
package/pages/prefs.vue CHANGED
@@ -70,7 +70,25 @@ export default {
70
70
  dateOptions() {
71
71
  const now = day();
72
72
 
73
- return this.$store.getters['prefs/options'](DATE_FORMAT).map((value) => {
73
+ const currentDate = this.$store.getters['prefs/options'](DATE_FORMAT).map((value) => {
74
+ return now.format(value);
75
+ });
76
+
77
+ // Check for duplication of date (date with same digit in month and day) in options list eg. (3/3/2023)
78
+ const isDuplicate = currentDate.some((item, idx) => {
79
+ return currentDate.indexOf(item) !== idx;
80
+ });
81
+
82
+ return this.$store.getters['prefs/options'](DATE_FORMAT).map((value, index) => {
83
+ const updateValue = `${ now.format(value) } (${ value })`;
84
+
85
+ if (index > 1 && isDuplicate) {
86
+ return {
87
+ label: updateValue,
88
+ value
89
+ };
90
+ }
91
+
74
92
  return {
75
93
  label: now.format(value),
76
94
  value
@@ -210,6 +228,7 @@ export default {
210
228
  v-model="dateFormat"
211
229
  data-testid="prefs__displaySetting__dateFormat"
212
230
  :label="t('prefs.dateFormat.label')"
231
+ option-key="value"
213
232
  :options="dateOptions"
214
233
  />
215
234
  </div>
package/plugins/plugin.js CHANGED
@@ -30,7 +30,7 @@ export default async function(context) {
30
30
  const entries = res.entries || res.Entries || {};
31
31
 
32
32
  Object.values(entries).forEach((plugin) => {
33
- const shouldNotLoad = shouldNotLoadPlugin(plugin, rancherVersion); // Error key string or false
33
+ const shouldNotLoad = shouldNotLoadPlugin(plugin, rancherVersion); // Error key string or boolean
34
34
 
35
35
  if (!shouldNotLoad) {
36
36
  hash[plugin.name] = context.$plugin.loadPluginAsync(plugin);
package/public/index.html CHANGED
@@ -13,7 +13,12 @@
13
13
  <div id="app">
14
14
  <script>
15
15
  (() => {
16
- const isDark = document.cookie.includes('R_PCS=dark');
16
+ const isDark = document.cookie.includes('R_THEME=auto') ?
17
+ // User selected automatic theme, so use pcs (set when ui previously loaded and is either os theme or time of day based
18
+ document.cookie.includes('R_PCS=dark') :
19
+ // Otherwise user selected light/dark theme directly
20
+ document.cookie.includes('R_THEME=dark');
21
+
17
22
  const color = isDark ? '#1b1c21' : '#FFF';
18
23
  const style = document.createElement('style');
19
24
  style.innerHTML = ':root { --loading-bg-color: ' + color + ';}';
@@ -58,6 +58,7 @@ export default Vue.extend({
58
58
  <div
59
59
  class="card-container"
60
60
  :class="{'highlight-border': showHighlightBorder, 'card-sticky': sticky}"
61
+ data-testid="card"
61
62
  >
62
63
  <div class="card-wrap">
63
64
  <div
@@ -209,6 +209,7 @@ export default Vue.extend({
209
209
  <slot
210
210
  :listeners="$listeners"
211
211
  :option="option"
212
+ :isDisabled="isDisabled"
212
213
  :name="i"
213
214
  >
214
215
  <RadioButton
@@ -8,7 +8,7 @@ RESET="\033[0m"
8
8
  BOLD="\033[1m"
9
9
 
10
10
  TMP=${BASE_DIR}/tmp
11
- CHART_TEMPLATE=${TMP}/ui-plugin-server
11
+ CHART_TEMPLATE=${TMP}/helm
12
12
 
13
13
  PKG="${1}"
14
14
  PKG_VERSION="${2}"
@@ -26,12 +26,28 @@ mkdir -p ${TMP}/container
26
26
  cp -R ${CHART_TEMPLATE}/* ${TMP}/container/
27
27
 
28
28
  # Copy the plugin assets
29
- rm -rf ${TMP}/container/plugin
30
- mkdir ${TMP}/container/plugin
29
+ mkdir -p ${TMP}/container/plugin
31
30
 
32
- cp -R ${BASE_DIR}/dist-pkg/${PKG_NAME}/* ${TMP}/container/plugin
31
+ cp -R ${BASE_DIR}/assets/* ${TMP}/container/plugin
32
+ cp ${BASE_DIR}/package.json ${TMP}/container/plugin
33
+ cp ${BASE_DIR}/index.yaml ${TMP}/container/
34
+ cp ${BASE_DIR}/index.yaml ${TMP}/container/plugin
33
35
  rm -f ${TMP}/container/plugin/report.html
34
36
 
37
+ # Generate files.txt for each pkg and move pkg files into relative plugin directories
38
+ for d in ${BASE_DIR}/dist-pkg/*; do
39
+ pkg=$(basename $d)
40
+
41
+ pushd ${BASE_DIR}/dist-pkg > /dev/null
42
+ mkdir plugin && mv ./${pkg}/* ./plugin
43
+ rm -rf ./${pkg}/* && mv ./plugin ./${pkg}
44
+
45
+ find ${pkg} -type f -printf '%P\n' | sort > ./${pkg}/files.txt
46
+ popd > /dev/null
47
+
48
+ cp -R ${BASE_DIR}/dist-pkg/${pkg} ${TMP}/container/plugin
49
+ done
50
+
35
51
  # Build the docker image
36
52
  pushd ${TMP}/container > /dev/null
37
53
  echo -e "${CYAN}Building container image ...${RESET}"
@@ -0,0 +1,23 @@
1
+ # Patterns to ignore when building packages.
2
+ # This supports shell glob matching, relative path matching, and
3
+ # negation (prefixed with !). Only one pattern per line.
4
+ .DS_Store
5
+ # Common VCS dirs
6
+ .git/
7
+ .gitignore
8
+ .bzr/
9
+ .bzrignore
10
+ .hg/
11
+ .hgignore
12
+ .svn/
13
+ # Common backup files
14
+ *.swp
15
+ *.bak
16
+ *.tmp
17
+ *.orig
18
+ *~
19
+ # Various IDEs
20
+ .project
21
+ .idea/
22
+ *.tmproj
23
+ .vscode/
@@ -0,0 +1,20 @@
1
+ annotations:
2
+ catalog.cattle.io/certified: rancher # Any application we are adding as a helm chart
3
+ catalog.cattle.io/kube-version: '>= 1.16.0-0 < 1.26.0-0'
4
+ catalog.cattle.io/namespace: cattle-ui-plugin-system # Must prefix with cattle- and suffix with -system=
5
+ catalog.cattle.io/os: linux
6
+ catalog.cattle.io/permits-os: linux, windows
7
+ catalog.cattle.io/rancher-version: '>= 2.7.0-0 < 2.8.0-0'
8
+ catalog.cattle.io/scope: management
9
+ catalog.cattle.io/ui-component: plugins
10
+ apiVersion: v2
11
+ appVersion: "0.1.0"
12
+ description: Extension server
13
+ name: extension-server
14
+ type: application
15
+ keywords:
16
+ - applications
17
+ - infrastructure
18
+ version: 0.1.0
19
+ icon: https://docs.ranchermanager.rancher.io/img/rancher-logo-horiz-color.svg
20
+ home: https://rancher.com
@@ -0,0 +1,52 @@
1
+ {{/*
2
+ Expand the name of the chart.
3
+ */}}
4
+ {{- define "extension-server.name" -}}
5
+ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
+ {{- end }}
7
+
8
+ {{/*
9
+ Create a default fully qualified app name.
10
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
+ If release name contains chart name it will be used as a full name.
12
+ */}}
13
+ {{- define "extension-server.fullname" -}}
14
+ {{- if .Values.fullnameOverride }}
15
+ {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16
+ {{- else }}
17
+ {{- $name := default .Chart.Name .Values.nameOverride }}
18
+ {{- if contains $name .Release.Name }}
19
+ {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20
+ {{- else }}
21
+ {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
25
+
26
+
27
+ {{/*
28
+ Create chart name and version as used by the chart label.
29
+ */}}
30
+ {{- define "extension-server.chart" -}}
31
+ {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
32
+ {{- end }}
33
+
34
+ {{/*
35
+ Common labels
36
+ */}}
37
+ {{- define "extension-server.labels" -}}
38
+ helm.sh/chart: {{ include "extension-server.chart" . }}
39
+ {{ include "extension-server.selectorLabels" . }}
40
+ {{- if .Chart.AppVersion }}
41
+ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42
+ {{- end }}
43
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
44
+ {{- end }}
45
+
46
+ {{/*
47
+ Selector labels
48
+ */}}
49
+ {{- define "extension-server.selectorLabels" -}}
50
+ app.kubernetes.io/name: {{ include "extension-server.name" . }}
51
+ app.kubernetes.io/instance: {{ .Release.Name }}
52
+ {{- end }}
@@ -0,0 +1,12 @@
1
+ apiVersion: catalog.cattle.io/v1
2
+ kind: UIPlugin
3
+ metadata:
4
+ name: {{ include "extension-server.fullname" . }}
5
+ namespace: {{ .Release.Namespace }}
6
+ labels: {{ include "extension-server.labels" . | nindent 4 }}
7
+ spec:
8
+ plugin:
9
+ name: {{ include "extension-server.fullname" . }}
10
+ version: {{ (semver (default .Chart.AppVersion .Values.plugin.versionOverride)).Original }}
11
+ endpoint: http://{{ include "extension-server.fullname" . }}.{{ .Release.Namespace }}.svc
12
+ noCache: {{ .Values.plugin.noCache }}
@@ -0,0 +1,6 @@
1
+ nameOverride: ""
2
+ fullnameOverride: ""
3
+ plugin:
4
+ enabled: true
5
+ versionOverride: ""
6
+ noCache: false
@@ -0,0 +1,27 @@
1
+ FROM registry.suse.com/bci/bci-base:15.4
2
+
3
+ RUN zypper -n install nginx jq
4
+
5
+ COPY package/nginx.conf /etc/nginx/nginx.conf
6
+
7
+ # Copy in plugin files and generate files.txt statically
8
+ COPY plugin /home/plugin-server/plugin-contents/plugin
9
+ COPY plugin/index.yaml /home/plugin-server/plugin-contents
10
+
11
+ RUN echo 'pluginserver:x:1000:1000::/home/pluginserver:/bin/bash' >> /etc/passwd && \
12
+ echo 'pluginserver:x:1000:' >> /etc/group && \
13
+ mkdir -p /home/plugin-server && \
14
+ mkdir -p /home/plugin-server/plugin-contents && \
15
+ chown -R pluginserver:pluginserver /etc/nginx/nginx.conf && \
16
+ chown -R pluginserver:pluginserver /home/plugin-server && \
17
+ chown -R pluginserver:pluginserver /var/lib/nginx && \
18
+ chown -R pluginserver:pluginserver /var/log/nginx && \
19
+ touch /run/nginx.pid && \
20
+ chown pluginserver:pluginserver /run/nginx.pid
21
+ USER pluginserver
22
+
23
+ WORKDIR /home/plugin-server/plugin-contents
24
+
25
+ RUN find plugin -type f | sort > files.txt
26
+
27
+ ENTRYPOINT ["nginx", "-g", "daemon off;"]
@@ -0,0 +1,17 @@
1
+ events {}
2
+ http {
3
+ sendfile on;
4
+ server {
5
+ listen 8080;
6
+ listen [::]:8080;
7
+
8
+ resolver 0.0.0.0;
9
+ autoindex on;
10
+
11
+ server_name _;
12
+ server_tokens off;
13
+
14
+ root /home/plugin-server/plugin-contents;
15
+ gzip_static on;
16
+ }
17
+ }
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ source $(dirname $0)/version
5
+
6
+ cd $(dirname $0)/..
7
+
8
+ if [[ -z ${ORG} ]] || [[ -z ${REPO} ]] || [[ -z ${TAG} ]]; then
9
+ echo "Usage: [REGISTRY=] ORG= REPO= TAG= ./scripts/package"
10
+ exit 1
11
+ fi
12
+
13
+ IMAGE=${ORG}/${REPO}:${TAG}
14
+ if [[ -n ${REGISTRY} ]]; then
15
+ IMAGE=${REGISTRY%/}/${IMAGE}
16
+ fi
17
+ DOCKERFILE=package/Dockerfile
18
+ if [ -e ${DOCKERFILE}.${ARCH} ]; then
19
+ DOCKERFILE=${DOCKERFILE}.${ARCH}
20
+ fi
21
+
22
+ docker build -f ${DOCKERFILE} -t ${IMAGE} .
23
+ echo Built ${IMAGE}
@@ -0,0 +1,101 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ cd $(dirname $0)/..
5
+
6
+ if [[ -z ${CHART} ]]; then
7
+ # Assume that the chart is the main one found in this repository
8
+ CHART="./charts/ui-plugin-server"
9
+ fi
10
+
11
+ if ! [[ -d ${CHART} ]]; then
12
+ echo "${CHART} is not a directory"
13
+ exit 1
14
+ fi
15
+
16
+ if ! [[ -f ${CHART}/Chart.yaml ]]; then
17
+ echo "${CHART} is not a valid Helm chart: could not find Chart.yaml"
18
+ exit 1
19
+ fi
20
+
21
+ if ! [[ -f ${CHART}/values.yaml ]]; then
22
+ echo "${CHART} does not have default values: could not find values.yaml"
23
+ exit 1
24
+ fi
25
+
26
+ if [[ -z ${REGISTRY} ]]; then
27
+ # By default, we assume you are using DockerHub
28
+ REGISTRY=""
29
+ fi
30
+
31
+ # Remove trailing slash if it exists
32
+ REGISTRY=${REGISTRY%/}
33
+
34
+ if [[ -z ${ORG} ]]; then
35
+ # By default, we assume this is a plugin hosted by Rancher
36
+ ORG=rancher
37
+ fi
38
+
39
+ if [[ -z ${PACKAGE_JSON} ]]; then
40
+ PACKAGE_JSON=plugin/package.json
41
+ fi
42
+
43
+ if ! [[ -f ${PACKAGE_JSON} ]]; then
44
+ echo "Could not find package.json at path ${PACKAGE_JSON}"
45
+ exit 1
46
+ fi
47
+
48
+ if [[ -z ${REPO} ]]; then
49
+ REPO=$(cat ${PACKAGE_JSON} | jq ".name" | tr -d '"')
50
+ fi
51
+
52
+ if [[ -z ${TAG} ]]; then
53
+ TAG=$(cat ${PACKAGE_JSON} | jq ".version" | tr -d '"')
54
+ fi
55
+
56
+ DESCRIPTION=$(cat ${PACKAGE_JSON} | jq ".description" | tr -d '"')
57
+ ICON=$(cat ${PACKAGE_JSON} | jq ".icon" | tr -d '"')
58
+ KEYWORDS=$(cat ${PACKAGE_JSON} | jq ".keywords")
59
+ HOME=$(cat ${PACKAGE_JSON} | jq ".homepage" | tr -d '"')
60
+
61
+ if [[ -z ${ORG} ]] || [[ -z ${REPO} ]] || [[ -z ${TAG} ]]; then
62
+ echo "Usage: [CHART=charts/ui-plugin-server] [REGISTRY=""] [ORG=rancher] [REPO=<override-repo>] [TAG=<override-tag>] [PACKAGE_JSON=plugin/package.json] ./scripts/patch <chart>"
63
+ exit 1
64
+ fi
65
+
66
+ # Edit Chart information to match plugin using yq
67
+ yq -i eval ".name = \"${REPO}\"" $CHART/Chart.yaml
68
+ yq -i eval ".appVersion = \"${TAG}\"" $CHART/Chart.yaml
69
+ yq -i eval ".version = \"${TAG}\"" $CHART/Chart.yaml
70
+
71
+ if [[ -n "${DESCRIPTION}" ]]; then
72
+ if [[ "${DESCRIPTION}" == "null" ]]; then
73
+ yq -i eval "del(.description)" $CHART/Chart.yaml
74
+ else
75
+ yq -i eval ".description = \"${DESCRIPTION}\"" $CHART/Chart.yaml
76
+ fi
77
+ fi
78
+
79
+ if [[ -n "${ICON}" ]]; then
80
+ if [[ "${ICON}" == "null" ]]; then
81
+ yq -i eval "del(.icon)" $CHART/Chart.yaml
82
+ else
83
+ yq -i eval ".icon = \"${ICON}\"" $CHART/Chart.yaml
84
+ fi
85
+ fi
86
+
87
+ if [[ -n "${KEYWORDS}" ]]; then
88
+ if [[ "${KEYWORDS}" == "null" ]]; then
89
+ yq -i eval "del(.keywords)" $CHART/Chart.yaml
90
+ else
91
+ yq -i -I2 eval ".keywords = ${KEYWORDS}" $CHART/Chart.yaml
92
+ fi
93
+ fi
94
+
95
+ if [[ -n "${HOME}" ]]; then
96
+ if [[ "${HOME}" == "null" ]]; then
97
+ yq -i eval "del(.home)" $CHART/Chart.yaml
98
+ else
99
+ yq -i eval ".home = \"${HOME}\"" $CHART/Chart.yaml
100
+ fi
101
+ fi
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$ARCH" ]; then
4
+ ARCH=$(go env GOHOSTARCH)
5
+ fi
6
+
7
+ SUFFIX="-${ARCH}"
8
+
9
+ if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
10
+ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
11
+ DIRTY="-dirty"
12
+ fi
13
+
14
+ COMMIT=$(git rev-parse --short HEAD)
15
+ GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}
16
+
17
+ if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
18
+ VERSION=$GIT_TAG
19
+ else
20
+ VERSION="${COMMIT}${DIRTY}"
21
+ fi
22
+
23
+ TAG=${TAG:-${VERSION}${SUFFIX}}
24
+ fi
25
+
26
+ REPO=${REPO:-ui-plugin-server}
27
+ ORG=${ORG:-rancher}
28
+
29
+ if echo $TAG | grep -q dirty; then
30
+ TAG=dev
31
+ fi
@@ -12,14 +12,13 @@ const yaml = require('js-yaml');
12
12
 
13
13
  console.log('Helm file update');
14
14
 
15
- if (process.argv.length !== 5) {
15
+ if (process.argv.length !== 4) {
16
16
  console.log('Incorrect number of arguments');
17
17
  process.exit(1);
18
18
  }
19
19
 
20
20
  const destFolder = process.argv[2];
21
21
  const pkgFilePath = process.argv[3];
22
- const image = process.argv[4];
23
22
 
24
23
  const pkgFile = JSON.parse(fs.readFileSync(pkgFilePath, 'utf8'));
25
24
 
@@ -50,40 +49,19 @@ if (pkgFile.rancher && typeof pkgFile.rancher === 'object') {
50
49
  }
51
50
  }
52
51
 
53
- if (updated ){
52
+ if (updated) {
54
53
  // Write out updated file
55
54
  const str = yaml.dump(chart);
56
55
 
57
56
  fs.writeFileSync(chartFile, str, 'utf8');
58
57
  }
59
58
 
60
- // chart.name = pkgFile.name;
61
- // chart.appVersion = pkgFile.version;
62
- // chart.version = pkgFile.version;
63
- // chart.description = pkgFile.description || `${pkgFile.name} ui plugin `;
64
- // chart.annotations[UI_PLUGIN_ANNOTATION_NAME] = UI_PLUGIN_ANNOTATION_VALUE;
65
-
66
- // if (pkgFile.icon) {
67
- // chart.icon = pkgFile.icon;
68
- // }
69
-
70
- // if (pkgFile.keywords) {
71
- // chart.keywords = pkgFile.keywords;
72
- // } else {
73
- // chart.keywords = [];
74
- // }
75
-
76
- // if (pkgFile.homepage) {
77
- // chart.home = pkgFile.homepage;
78
- // }
79
-
80
59
  // --------------------------------------------------------------------------------
81
60
  // values.yaml
82
61
  // --------------------------------------------------------------------------------
83
62
 
84
63
  const values = yaml.load(fs.readFileSync(valuesFile, 'utf8'));
85
64
 
86
- values.pluginServer.image.repository = `${image}`;
65
+ const valuesYaml = yaml.dump(values, { quotingType: '"' });
87
66
 
88
- const valuesYaml = yaml.dump(values, {quotingType: '"' });
89
67
  fs.writeFileSync(valuesFile, valuesYaml, 'utf8');