@rancher/shell 0.3.4 → 0.3.6
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.
- package/assets/images/providers/outscale.svg +19 -0
- package/assets/styles/app.scss +1 -1
- package/assets/styles/base/_basic.scss +18 -0
- package/assets/styles/base/_mixins.scss +0 -11
- package/assets/styles/base/_variables.scss +2 -4
- package/assets/styles/fonts/_fontstack.scss +11 -11
- package/assets/styles/global/_button.scss +12 -2
- package/assets/styles/vendor/vue-js-modal.scss +3 -3
- package/assets/translations/en-us.yaml +113 -22
- package/assets/translations/zh-hans.yaml +113 -24
- package/babel.config.js +13 -0
- package/chart/gatekeeper.vue +78 -0
- package/chart/istio.vue +135 -112
- package/chart/logging/index.vue +13 -4
- package/chart/monitoring/index.vue +15 -5
- package/chart/monitoring/steps/uninstall-v1.vue +2 -2
- package/chart/rancher-backup/index.vue +10 -3
- package/cloud-credential/aws.vue +1 -1
- package/cloud-credential/digitalocean.vue +1 -1
- package/cloud-credential/gcp.vue +1 -1
- package/cloud-credential/generic.vue +2 -2
- package/cloud-credential/linode.vue +1 -1
- package/cloud-credential/pnap.vue +1 -1
- package/components/ActionMenu.vue +3 -4
- package/components/AssignTo.vue +1 -1
- package/components/AsyncButton.vue +1 -1
- package/components/BannerGraphic.vue +1 -1
- package/components/BrandImage.vue +1 -4
- package/components/ButtonDropdown.vue +2 -3
- package/components/Carousel.vue +85 -37
- package/components/ChartPsp.vue +76 -0
- package/components/CruResource.vue +6 -2
- package/components/DashboardMetrics.vue +12 -10
- package/components/DetailText.vue +1 -1
- package/components/DisableAuthProviderModal.vue +1 -1
- package/components/EmberPage.vue +1 -1
- package/components/EtcdInfoBanner.vue +12 -7
- package/components/ExplorerMembers.vue +101 -6
- package/components/ExplorerProjectsNamespaces.vue +46 -3
- package/components/FileDiff.vue +6 -7
- package/components/GrafanaDashboard.vue +27 -23
- package/components/LazyImage.vue +10 -12
- package/components/LogItem.vue +1 -1
- package/components/Markdown.vue +1 -1
- package/components/PromptRemove.vue +2 -2
- package/components/PromptRestore.vue +1 -1
- package/components/ResourceDetail/Masthead.vue +16 -0
- package/components/ResourceDetail/index.vue +21 -4
- package/components/ResourceList/index.vue +1 -1
- package/components/ResourceTable.vue +4 -1
- package/components/SingleClusterInfo.vue +2 -2
- package/components/SortableTable/THead.vue +1 -1
- package/components/SortableTable/index.vue +28 -13
- package/components/SortableTable/selection.js +58 -50
- package/components/Wizard.vue +4 -2
- package/components/__tests__/AsyncButton.test.ts +3 -1
- package/components/__tests__/ChartPsp.test.ts +75 -0
- package/components/__tests__/CruResource.test.ts +3 -1
- package/components/auth/Principal.vue +1 -1
- package/components/auth/RoleDetailEdit.vue +2 -2
- package/components/fleet/FleetBundles.vue +3 -1
- package/components/fleet/FleetClusters.vue +1 -2
- package/components/fleet/FleetIntro.vue +9 -1
- package/components/fleet/FleetNoWorkspaces.vue +62 -0
- package/components/fleet/FleetSummary.vue +7 -1
- package/components/form/HookOption.vue +14 -10
- package/components/form/LabeledSelect.vue +14 -11
- package/components/form/Labels.vue +32 -27
- package/components/form/MatchExpressions.vue +19 -4
- package/components/form/Members/ClusterPermissionsEditor.vue +32 -7
- package/components/form/NameNsDescription.vue +32 -46
- package/components/form/ProjectMemberEditor.vue +46 -21
- package/components/form/ResourceSelector.vue +1 -1
- package/components/form/SecretSelector.vue +5 -1
- package/components/form/ServiceNameSelect.vue +1 -1
- package/components/form/SimpleSecretSelector.vue +9 -9
- package/components/form/Tolerations.vue +4 -1
- package/components/form/ValueFromResource.vue +14 -9
- package/components/form/WorkloadPorts.vue +2 -2
- package/components/form/__tests__/LabeledSelect.test.ts +138 -0
- package/components/form/__tests__/NameNsDescription.ts +59 -0
- package/components/formatter/InternalExternalIP.vue +6 -0
- package/components/formatter/InvolvedObjectLink.vue +54 -0
- package/components/formatter/Link.vue +20 -4
- package/components/formatter/LinkName.vue +6 -1
- package/components/formatter/ServiceTargets.vue +1 -1
- package/components/formatter/WorkloadHealthScale.vue +8 -2
- package/components/nav/Group.vue +2 -2
- package/components/nav/NamespaceFilter.vue +23 -11
- package/components/nav/TopLevelMenu.vue +2 -4
- package/components/nav/Type.vue +1 -1
- package/components/nav/WorkspaceSwitcher.vue +46 -5
- package/components/nuxt/nuxt-build-indicator.vue +143 -0
- package/components/nuxt/nuxt-child.js +122 -0
- package/components/nuxt/nuxt-error.vue +98 -0
- package/components/nuxt/nuxt-link.client.js +98 -0
- package/components/nuxt/nuxt-link.server.js +16 -0
- package/components/nuxt/nuxt-loading.vue +154 -0
- package/components/nuxt/nuxt.js +101 -0
- package/config/labels-annotations.js +17 -0
- package/config/middleware.js +12 -0
- package/config/product/auth.js +3 -2
- package/config/product/explorer.js +34 -6
- package/config/product/fleet.js +2 -0
- package/config/query-params.js +1 -0
- package/config/router.js +414 -0
- package/config/store.js +181 -0
- package/config/table-headers.js +54 -12
- package/config/types.js +18 -8
- package/config/uiplugins.js +30 -0
- package/content/docs/en-us/whats-new.md +10 -0
- package/content/docs/zh-hans/whats-new.md +11 -1
- package/core/plugin-routes.ts +23 -0
- package/core/plugin.ts +4 -2
- package/core/types.ts +258 -1
- package/creators/app/app.package.json +2 -1
- package/creators/app/files/.eslintrc.js +1 -1
- package/creators/app/files/babel.config.js +1 -18
- package/creators/app/files/tsconfig.json +0 -1
- package/creators/app/files/vue.config.js +6 -0
- package/creators/app/init +5 -5
- package/creators/pkg/files/.github/workflows/build-extension.yml +110 -0
- package/creators/pkg/files/tsconfig.json +0 -1
- package/creators/pkg/init +35 -4
- package/creators/pkg/pkg.package.json +3 -3
- package/creators/update/init +1 -1
- package/detail/constraints.gatekeeper.sh.constraint.vue +34 -17
- package/detail/fleet.cattle.io.clustergroup.vue +7 -1
- package/detail/fleet.cattle.io.gitrepo.vue +19 -11
- package/detail/harvesterhci.io.management.cluster.vue +3 -3
- package/detail/provisioning.cattle.io.cluster.vue +54 -12
- package/detail/workload/index.vue +3 -3
- package/dialog/AddClusterMemberDialog.vue +1 -1
- package/dialog/AddProjectMemberDialog.vue +2 -2
- package/dialog/AddonConfigConfirmationDialog.vue +27 -15
- package/dialog/DiagnosticTimingsDialog.vue +1 -1
- package/dialog/ForceMachineRemoveDialog.vue +1 -1
- package/dialog/GenericPrompt.vue +18 -6
- package/dialog/RotateEncryptionKeyDialog.vue +1 -1
- package/dialog/SaveAsRKETemplateDialog.vue +1 -1
- package/dialog/ScaleMachineDownDialog.vue +1 -1
- package/edit/auth/github.vue +8 -8
- package/edit/auth/googleoauth.vue +5 -5
- package/edit/auth/ldap/index.vue +1 -1
- package/edit/auth/oidc.vue +1 -1
- package/edit/auth/saml.vue +1 -1
- package/edit/cis.cattle.io.clusterscan.vue +1 -1
- package/edit/fleet.cattle.io.clustergroup.vue +6 -4
- package/edit/fleet.cattle.io.gitrepo.vue +32 -4
- package/edit/helm.cattle.io.projecthelmchart.vue +5 -1
- package/edit/logging.banzaicloud.io.output/index.vue +18 -5
- package/edit/logging.banzaicloud.io.output/providers/loki.vue +1 -0
- package/edit/management.cattle.io.fleetworkspace.vue +141 -6
- package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +4 -1
- package/edit/management.cattle.io.setting.vue +1 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/types/webhook.vue +2 -2
- package/edit/monitoring.coreos.com.receiver/tls.vue +18 -18
- package/edit/monitoring.coreos.com.receiver/types/webhook.banner.vue +4 -4
- package/edit/monitoring.coreos.com.receiver/types/webhook.vue +1 -1
- package/edit/namespace.vue +14 -10
- package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +126 -45
- package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/MachinePool.vue +21 -4
- package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +1 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +202 -2
- package/edit/provisioning.cattle.io.cluster/import.vue +23 -25
- package/edit/provisioning.cattle.io.cluster/rke2.vue +344 -102
- package/edit/resources.cattle.io.backup.vue +1 -1
- package/edit/service.vue +1 -1
- package/edit/storage.k8s.io.storageclass/provisioners/driver.harvesterhci.io.vue +2 -2
- package/edit/workload/__tests__/Job.test.ts +3 -1
- package/edit/workload/index.vue +8 -3
- package/edit/workload/mixins/workload.js +22 -7
- package/edit/workload/storage/Mount.vue +3 -3
- package/initialize/App.js +206 -0
- package/initialize/client.js +863 -0
- package/initialize/index.js +364 -0
- package/layouts/default.vue +7 -3
- package/layouts/standalone.vue +13 -0
- package/list/catalog.cattle.io.clusterrepo.vue +1 -0
- package/list/fleet.cattle.io.bundle.vue +6 -3
- package/list/fleet.cattle.io.clusterregistrationtoken.vue +3 -1
- package/list/fleet.cattle.io.gitrepo.vue +44 -5
- package/list/management.cattle.io.fleetworkspace.vue +45 -0
- package/list/node.vue +69 -16
- package/list/provisioning.cattle.io.cluster.vue +30 -1
- package/list/rbac.authorization.k8s.io.clusterrolebinding.vue +48 -0
- package/list/workload.vue +6 -4
- package/machine-config/azure.vue +97 -38
- package/middleware/authenticated.js +34 -0
- package/mixins/chart.js +101 -2
- package/mixins/fetch.client.js +95 -0
- package/mixins/fetch.server.js +73 -0
- package/mixins/labeled-form-element.ts +2 -2
- package/mixins/resource-fetch.js +2 -2
- package/models/apps.statefulset.js +28 -0
- package/models/cluster/node.js +23 -2
- package/models/cluster.x-k8s.io.machine.js +4 -2
- package/models/clusterroletemplatebinding.js +7 -0
- package/models/constraints.gatekeeper.sh.constraint.js +46 -0
- package/models/fleet.cattle.io.cluster.js +19 -10
- package/models/fleet.cattle.io.gitrepo.js +7 -2
- package/models/management.cattle.io.cluster.js +1 -1
- package/models/management.cattle.io.fleetworkspace.js +12 -0
- package/models/management.cattle.io.gitreporestriction.js +5 -0
- package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.js +3 -0
- package/models/pod.js +4 -0
- package/models/provisioning.cattle.io.cluster.js +7 -5
- package/models/rbac.authorization.k8s.io.clusterrolebinding.js +16 -0
- package/models/rbac.authorization.k8s.io.rolebinding.js +16 -0
- package/package.json +13 -21
- package/pages/auth/setup.vue +2 -2
- package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +33 -0
- package/pages/c/_cluster/apps/charts/chart.vue +4 -4
- package/pages/c/_cluster/apps/charts/install.helpers.js +26 -0
- package/pages/c/_cluster/apps/charts/install.vue +98 -102
- package/pages/c/_cluster/explorer/EventsTable.vue +5 -19
- package/pages/c/_cluster/explorer/index.vue +29 -25
- package/pages/c/_cluster/explorer/tools/index.vue +8 -8
- package/pages/c/_cluster/fleet/index.vue +95 -34
- package/pages/c/_cluster/gatekeeper/index.vue +1 -1
- package/pages/c/_cluster/istio/index.vue +5 -5
- package/pages/c/_cluster/manager/cloudCredential/index.vue +1 -1
- package/pages/c/_cluster/monitoring/index.vue +7 -0
- package/pages/c/_cluster/uiplugins/InstallDialog.vue +8 -8
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +20 -7
- package/pages/c/_cluster/uiplugins/index.vue +49 -17
- package/pages/diagnostic.vue +32 -25
- package/pages/home.vue +9 -4
- package/pages/index.vue +10 -1
- package/pages/rio/mesh.vue +1 -2
- package/pkg/tsconfig.json +0 -1
- package/plugins/clean-html-directive.js +34 -0
- package/plugins/dashboard-store/actions.js +32 -9
- package/plugins/dashboard-store/index.js +1 -1
- package/plugins/dashboard-store/mutations.js +5 -2
- package/plugins/dashboard-store/resource-class.js +8 -1
- package/plugins/plugin.js +0 -14
- package/plugins/portal-vue.js +4 -0
- package/plugins/steve/mutations.js +3 -2
- package/plugins/steve/steve-description-class.js +5 -1
- package/plugins/steve/subscribe.js +63 -54
- package/plugins/steve-create-worker.js +14 -0
- package/promptRemove/management.cattle.io.globalrole.vue +2 -2
- package/promptRemove/management.cattle.io.project.vue +2 -2
- package/promptRemove/management.cattle.io.roletemplate.vue +2 -2
- package/promptRemove/pod.vue +1 -1
- package/public/index.html +65 -0
- package/rancher-components/components/Banner/Banner.test.ts +7 -1
- package/rancher-components/components/Banner/Banner.vue +2 -1
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +2 -0
- package/rancher-components/components/Form/Radio/RadioButton.test.ts +31 -0
- package/rancher-components/components/Form/Radio/RadioButton.vue +14 -3
- package/scripts/build-pkg.sh +1 -0
- package/scripts/clean +6 -0
- package/scripts/extension/bundle +58 -0
- package/scripts/extension/helmpatch +89 -0
- package/scripts/extension/publish +333 -0
- package/scripts/serve-pkgs +6 -2
- package/scripts/test-plugins-build.sh +4 -0
- package/store/__tests__/index.test.ts +110 -0
- package/store/index.js +145 -58
- package/store/type-map.js +6 -2
- package/tsconfig.default.json +36 -0
- package/tsconfig.json +23 -0
- package/types/rancher/index.d.ts +2 -0
- package/types/shell/index.d.ts +466 -320
- package/utils/__tests__/grafana.test.ts +44 -0
- package/utils/__tests__/string.test.ts +12 -0
- package/utils/auth.js +65 -0
- package/utils/axios.js +190 -0
- package/utils/cookie-universal-nuxt.js +10 -0
- package/utils/dom.js +15 -0
- package/utils/grafana.js +35 -16
- package/utils/monitoring.js +2 -1
- package/utils/nuxt.js +659 -0
- package/utils/position.js +5 -8
- package/utils/router.scrollBehavior.js +80 -0
- package/utils/select.js +1 -3
- package/utils/socket.js +1 -0
- package/utils/string.js +13 -0
- package/utils/time.js +9 -0
- package/vue.config.js +690 -0
- package/chart/rancher-alerting-drivers.vue +0 -53
- package/chart/rancher-gatekeeper.vue +0 -37
- package/creators/app/files/nuxt.config.js +0 -6
- package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.ts +0 -4
- package/nuxt.config.js +0 -798
- package/plugins/dashboard-store/extensions.js +0 -22
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
4
|
+
BASE_DIR="$(pwd)"
|
|
5
|
+
|
|
6
|
+
CYAN="\033[96m"
|
|
7
|
+
YELLOW="\033[93m"
|
|
8
|
+
RESET="\033[0m"
|
|
9
|
+
BOLD="\033[1m"
|
|
10
|
+
NORMAL="\033[22m"
|
|
11
|
+
CHECK="\xE2\x9C\x94"
|
|
12
|
+
|
|
13
|
+
PUSH=""
|
|
14
|
+
REGISTRY=""
|
|
15
|
+
REGISTRY_ORG=""
|
|
16
|
+
IMAGE_PREFIX="ui-extension-"
|
|
17
|
+
FORCE="false"
|
|
18
|
+
GITHUB_BUILD="true"
|
|
19
|
+
|
|
20
|
+
GITHUB_SOURCE=$(git config --get remote.origin.url | sed -e 's/^git@.*:\([[:graph:]]*\).git/\1/')
|
|
21
|
+
GITHUB_BRANCH="main"
|
|
22
|
+
|
|
23
|
+
usage() {
|
|
24
|
+
echo "Usage: $0 [<options>] [plugins]"
|
|
25
|
+
echo " options:"
|
|
26
|
+
echo " -p Push container images on build"
|
|
27
|
+
echo " -f Force building the chart even if it already exists"
|
|
28
|
+
echo " -r <name> Specify destination container registry for built images"
|
|
29
|
+
echo " -o <name> Specify destination container registry organization for built images"
|
|
30
|
+
echo " -i <prefix> Specify prefix for the built container image (default: 'ui-extension-')"
|
|
31
|
+
echo " -c Build as a container image rather than publishing to Github"
|
|
32
|
+
echo " -s <repo> Specify destination GitHub repository (org/name) - defaults to the git origin"
|
|
33
|
+
echo " -b <branch> Specify destination GitHub branch"
|
|
34
|
+
exit 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
while getopts "hvr:o:pi:fcb:s:" opt; do
|
|
38
|
+
case $opt in
|
|
39
|
+
h)
|
|
40
|
+
usage
|
|
41
|
+
;;
|
|
42
|
+
p)
|
|
43
|
+
PUSH="--push"
|
|
44
|
+
;;
|
|
45
|
+
r)
|
|
46
|
+
REGISTRY="${OPTARG%/}/"
|
|
47
|
+
;;
|
|
48
|
+
o)
|
|
49
|
+
REGISTRY_ORG="${OPTARG}"
|
|
50
|
+
;;
|
|
51
|
+
i)
|
|
52
|
+
IMAGE_PREFIX="${OPTARG}"
|
|
53
|
+
;;
|
|
54
|
+
f)
|
|
55
|
+
FORCE="true"
|
|
56
|
+
;;
|
|
57
|
+
c)
|
|
58
|
+
GITHUB_BUILD="false"
|
|
59
|
+
;;
|
|
60
|
+
s)
|
|
61
|
+
GITHUB_BUILD="true"
|
|
62
|
+
GITHUB_SOURCE="${OPTARG}"
|
|
63
|
+
;;
|
|
64
|
+
b)
|
|
65
|
+
GITHUB_BUILD="true"
|
|
66
|
+
GITHUB_BRANCH="${OPTARG}"
|
|
67
|
+
;;
|
|
68
|
+
*)
|
|
69
|
+
usage
|
|
70
|
+
;;
|
|
71
|
+
esac
|
|
72
|
+
done
|
|
73
|
+
|
|
74
|
+
shift $((OPTIND-1))
|
|
75
|
+
|
|
76
|
+
PLUGINS=( "$@" )
|
|
77
|
+
BUILT="false"
|
|
78
|
+
|
|
79
|
+
echo -e "${CYAN}${BOLD}Publishing UI Plugins${RESET}"
|
|
80
|
+
|
|
81
|
+
pushd ${BASE_DIR} > /dev/null
|
|
82
|
+
|
|
83
|
+
if [ "${GITHUB_BUILD}" == "true" ]; then
|
|
84
|
+
# Determine if gh-pages build is possible
|
|
85
|
+
if [[ "${GITHUB_BRANCH}" == "gh-pages" ]] && ! git show-ref -q --heads gh-pages; then
|
|
86
|
+
echo -e "${YELLOW}'gh-pages' branch not found, this branch must exist before running this script${RESET}"
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
echo -e "${CYAN}GitHub Repository: ${GITHUB_SOURCE}${RESET}"
|
|
91
|
+
echo -e "${CYAN}GitHub Branch : ${GITHUB_BRANCH}${RESET}"
|
|
92
|
+
else
|
|
93
|
+
echo -e ${CYAN}"Image prefix: ${IMAGE_PREFIX}${RESET}"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# --------------------------------------------------------------------------------
|
|
97
|
+
# Check that we have the required commands avaialble for this script
|
|
98
|
+
# --------------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
if ! [[ -f ${BASE_DIR}/package.json ]]; then
|
|
101
|
+
echo -e "${YELLOW}You must run from the top-level folder${RESET}"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Check this is a Rancher extension
|
|
106
|
+
IS_SHELL=$(grep "\"@rancher/shell" package.json -c)
|
|
107
|
+
|
|
108
|
+
if [ "${IS_SHELL}" -ne 1 ]; then
|
|
109
|
+
echo -e "${YELLOW}Current folder does not appear to contain Rancher Extensions${RESET}"
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
if ! [[ -d ${BASE_DIR}/node_modules ]]; then
|
|
114
|
+
echo -e "${YELLOW}You must run ${BOLD}yarn install${NORMAL} before running this script${RESET}"
|
|
115
|
+
exit 1
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
COMMANDS=("node" "jq" "yq" "git" "docker" "helm" "yarn")
|
|
119
|
+
HAVE_COMMANDS="true"
|
|
120
|
+
for CMD in "${COMMANDS[@]}"
|
|
121
|
+
do
|
|
122
|
+
if ! command -v ${CMD} >/dev/null; then
|
|
123
|
+
echo -e "${YELLOW}This script requires ${BOLD}${CMD}${NORMAL} to be installed and on your PATH${RESET}"
|
|
124
|
+
HAVE_COMMANDS="false"
|
|
125
|
+
fi
|
|
126
|
+
done
|
|
127
|
+
|
|
128
|
+
if [ "${HAVE_COMMANDS}" == "false" ]; then
|
|
129
|
+
exit 1
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# --------------------------------------------------------------------------------
|
|
133
|
+
# Only do conatiner args checks if not GitHub publish
|
|
134
|
+
if [ "${GITHUB_BUILD}" == "false" ]; then
|
|
135
|
+
if [[ -z ${REGISTRY_ORG} ]]; then
|
|
136
|
+
# Infer that the user has the same Docker registry org as their GitHub org
|
|
137
|
+
GITHUB_REPO=$(git config --get remote.origin.url | sed -e 's/^git@.*:\([[:graph:]]*\).git/\1/')
|
|
138
|
+
REGISTRY_ORG=$(dirname ${GITHUB_REPO})
|
|
139
|
+
echo -e "Inferring built images will reside in registry organization ${CYAN}${BOLD}${REGISTRY}${REGISTRY_ORG}${RESET} based on configured origin remote pointing to ${CYAN}${BOLD}${GITHUB_REPO}${RESET}"
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
if [[ -z ${REGISTRY_ORG} ]]; then
|
|
143
|
+
# Inferring from the git config still failed
|
|
144
|
+
echo "Cannot build images without valid organization for Docker images. Unable to infer REGISTRY_ORG="
|
|
145
|
+
exit 1
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
docker images > /dev/null
|
|
149
|
+
if [ $? -ne 0 ]; then
|
|
150
|
+
echo "docker is not running - this is required to build container images for the UI Plugins"
|
|
151
|
+
exit 1
|
|
152
|
+
fi
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
ASSETS=${BASE_DIR}/assets
|
|
156
|
+
CHARTS=${BASE_DIR}/charts
|
|
157
|
+
mkdir -p ${ASSETS}
|
|
158
|
+
mkdir -p ${CHARTS}
|
|
159
|
+
|
|
160
|
+
TMP=${BASE_DIR}/tmp
|
|
161
|
+
CHART_TMP=${BASE_DIR}/tmp/_charts
|
|
162
|
+
rm -rf ${TMP}
|
|
163
|
+
mkdir -p ${TMP}
|
|
164
|
+
|
|
165
|
+
CHART_TEMPLATE=${BASE_DIR}/tmp/ui-plugin-server
|
|
166
|
+
|
|
167
|
+
# --------------------------------------------------------------------------------
|
|
168
|
+
# Clone the plugin server template into the temporary folder
|
|
169
|
+
# --------------------------------------------------------------------------------
|
|
170
|
+
pushd ${TMP} > /dev/null
|
|
171
|
+
git clone -q https://github.com/nwmac/ui-plugin-server.git
|
|
172
|
+
popd > /dev/null
|
|
173
|
+
|
|
174
|
+
# --------------------------------------------------------------------------------
|
|
175
|
+
# Iterate through all packages - built them all or build only those specified on the command line
|
|
176
|
+
# --------------------------------------------------------------------------------
|
|
177
|
+
for d in pkg/*/ ; do
|
|
178
|
+
pkg=$(basename $d)
|
|
179
|
+
|
|
180
|
+
if [ -z "$1" ] || [[ " ${PLUGINS[*]} " =~ " ${pkg} " ]]; then
|
|
181
|
+
# Check we don't already have a published version by looking in the assets folder
|
|
182
|
+
PKG_VERSION=$(jq -r .version ./pkg/${pkg}/package.json)
|
|
183
|
+
PKG_NAME="${pkg}-${PKG_VERSION}"
|
|
184
|
+
PKG_ASSET=${ASSETS}/${pkg}/${PKG_NAME}.tgz
|
|
185
|
+
|
|
186
|
+
echo -e "${CYAN}${BOLD}Building plugin: ${pkg} (${PKG_VERSION}) ${RESET}"
|
|
187
|
+
|
|
188
|
+
echo "Package version: ${PKG_VERSION}"
|
|
189
|
+
echo "Package folder: ${PKG_NAME}"
|
|
190
|
+
|
|
191
|
+
# --------------------------------------------------------------------------------
|
|
192
|
+
# Build the plugin from source
|
|
193
|
+
# --------------------------------------------------------------------------------
|
|
194
|
+
echo -e "${CYAN}Building plugin from source code${RESET}"
|
|
195
|
+
FORCE_COLOR=1 yarn build-pkg $pkg | cat
|
|
196
|
+
|
|
197
|
+
echo -e "${CYAN}Adding plugin code ...${RESET}"
|
|
198
|
+
|
|
199
|
+
EXT_FOLDER=${BASE_DIR}/extensions/${pkg}/${PKG_VERSION}
|
|
200
|
+
PKG_DIST="${BASE_DIR}/dist-pkg/${PKG_NAME}"
|
|
201
|
+
|
|
202
|
+
rm -rf ${EXT_FOLDER}
|
|
203
|
+
|
|
204
|
+
mkdir -p ${EXT_FOLDER}/plugin
|
|
205
|
+
|
|
206
|
+
# Copy the code into the folder
|
|
207
|
+
cp -R ${PKG_DIST}/* ${EXT_FOLDER}/plugin
|
|
208
|
+
|
|
209
|
+
pushd ${BASE_DIR}/extensions/${pkg}/${PKG_VERSION} > /dev/null
|
|
210
|
+
rm -f plugin/report.html
|
|
211
|
+
find plugin -type f | sort > files.txt
|
|
212
|
+
popd > /dev/null
|
|
213
|
+
|
|
214
|
+
rm -rf ${TMP}/container
|
|
215
|
+
|
|
216
|
+
# --------------------------------------------------------------------------------
|
|
217
|
+
# Create the Helm chart
|
|
218
|
+
# --------------------------------------------------------------------------------
|
|
219
|
+
|
|
220
|
+
if [ -f ${PKG_ASSET} ] && [ "${FORCE}" == "false" ]; then
|
|
221
|
+
echo -e "${YELLOW}Helm chart has already been created - skipping (run with -f to force build)${RESET}"
|
|
222
|
+
continue;
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
CHART_FOLDER=${CHARTS}/${pkg}/${PKG_VERSION}
|
|
226
|
+
|
|
227
|
+
mkdir -p ${ASSETS}/${pkg}
|
|
228
|
+
rm -rf ${CHART_FOLDER}
|
|
229
|
+
mkdir -p ${CHART_FOLDER}
|
|
230
|
+
|
|
231
|
+
cp -R ${CHART_TEMPLATE}/charts/ui-plugin-server/* ${CHART_FOLDER}
|
|
232
|
+
|
|
233
|
+
# Update Chart.yaml and values.yaml from the package file metadata
|
|
234
|
+
# Use the script from the template repository
|
|
235
|
+
echo -e "${CYAN}Patching Helm chart template${RESET}"
|
|
236
|
+
|
|
237
|
+
CHART=${CHART_FOLDER} REGISTRY="${REGISTRY}" ORG="${REGISTRY_ORG}" PACKAGE_JSON=${BASE_DIR}/pkg/${pkg}/package.json ${CHART_TEMPLATE}/scripts/patch
|
|
238
|
+
|
|
239
|
+
# Copy README file from the plugin to the Helm chart, if there is one
|
|
240
|
+
if [ -f "./pkg/${pkg}/README.md" ]; then
|
|
241
|
+
cp ./pkg/${pkg}/README.md ${CHART_FOLDER}/README.md
|
|
242
|
+
fi
|
|
243
|
+
|
|
244
|
+
if [ "${GITHUB_BUILD}" == "true" ]; then
|
|
245
|
+
echo "Patching for GitHub build"
|
|
246
|
+
pushd ${CHART_FOLDER} > /dev/null
|
|
247
|
+
cd templates
|
|
248
|
+
mv cr.yaml temp.cr
|
|
249
|
+
rm *.yaml
|
|
250
|
+
mv temp.cr cr.yaml
|
|
251
|
+
ENDPOINT=https://raw.githubusercontent.com/${GITHUB_SOURCE}/${GITHUB_BRANCH}/extensions/${pkg}/${PKG_VERSION}
|
|
252
|
+
sed -i.bak -e 's@endpoint: .*@endpoint: '"${ENDPOINT}"'@g' cr.yaml
|
|
253
|
+
rm *.bak
|
|
254
|
+
popd > /dev/null
|
|
255
|
+
fi
|
|
256
|
+
|
|
257
|
+
# Additional patches
|
|
258
|
+
${SCRIPT_DIR}/helmpatch ${CHART_FOLDER} "${BASE_DIR}/pkg/${pkg}/package.json" "${REGISTRY}${REGISTRY_ORG}/${IMAGE_PREFIX}${pkg}"
|
|
259
|
+
|
|
260
|
+
# Package into a .tgz helm chart
|
|
261
|
+
helm package ${CHART_FOLDER} -d ${ASSETS}/${pkg}
|
|
262
|
+
|
|
263
|
+
# --------------------------------------------------------------------------------
|
|
264
|
+
# Update the helm index just for this chart
|
|
265
|
+
# --------------------------------------------------------------------------------
|
|
266
|
+
HELM_INDEX=${BASE_DIR}/index.yaml
|
|
267
|
+
|
|
268
|
+
if [ -f "${HELM_INDEX}" ]; then
|
|
269
|
+
UPDATE="--merge ${HELM_INDEX}"
|
|
270
|
+
elif [ "${GITHUB_BUILD}" == "true" ] && [[ -n ${GITHUB_SOURCE} ]]; then
|
|
271
|
+
GITHUB_SOURCE=$(echo -e "${GITHUB_SOURCE}" | sed 's/https:\/\///g')
|
|
272
|
+
|
|
273
|
+
# Check if git branch contains index.yaml
|
|
274
|
+
wget -P ${BASE_DIR} https://raw.githubusercontent.com/${GITHUB_SOURCE}/${GITHUB_BRANCH}/index.yaml
|
|
275
|
+
|
|
276
|
+
if [ -f "${HELM_INDEX}" ]; then
|
|
277
|
+
UPDATE="--merge ${HELM_INDEX}"
|
|
278
|
+
fi
|
|
279
|
+
fi
|
|
280
|
+
|
|
281
|
+
# Base URL referencing assets directly from GitHub
|
|
282
|
+
BASE_URL="assets/${pkg}"
|
|
283
|
+
|
|
284
|
+
rm -rf ${CHART_TMP}
|
|
285
|
+
mkdir -p ${CHART_TMP}
|
|
286
|
+
cp ${ASSETS}/${pkg}/*.tgz ${CHART_TMP}
|
|
287
|
+
|
|
288
|
+
helm repo index ${CHART_TMP} --url ${BASE_URL} ${UPDATE}
|
|
289
|
+
|
|
290
|
+
cp ${CHART_TMP}/index.yaml ${HELM_INDEX}
|
|
291
|
+
|
|
292
|
+
if [ "${GITHUB_BUILD}" == "true" ]; then
|
|
293
|
+
# Make temp directory for workflow build artifact
|
|
294
|
+
mkdir -p tmp/{assets,charts,extensions}/$pkg
|
|
295
|
+
|
|
296
|
+
cp -r ${PKG_ASSET} tmp/assets/$pkg
|
|
297
|
+
cp -r ${CHARTS}/${pkg}/${PKG_VERSION} tmp/charts/$pkg
|
|
298
|
+
cp -r ${EXT_FOLDER} tmp/extensions/$pkg
|
|
299
|
+
fi
|
|
300
|
+
|
|
301
|
+
BUILT="true"
|
|
302
|
+
fi
|
|
303
|
+
done
|
|
304
|
+
|
|
305
|
+
if [ "${GITHUB_BUILD}" == "false" ]; then
|
|
306
|
+
BASE=$(basename ${BASE_DIR})
|
|
307
|
+
EXT_VERSION=$(jq -r .version ${BASE_DIR}/package.json)
|
|
308
|
+
|
|
309
|
+
if [ -z ${EXT_VERSION} ]; then
|
|
310
|
+
EXT_VERSION="0.0.0"
|
|
311
|
+
fi
|
|
312
|
+
|
|
313
|
+
echo -e "${CYAN}Base extension: ${BASE}${RESET}"
|
|
314
|
+
echo -e "${CYAN}Extension version: ${EXT_VERSION}${RESET}"
|
|
315
|
+
|
|
316
|
+
# Build the docker image
|
|
317
|
+
${SCRIPT_DIR}/bundle ${BASE} ${EXT_VERSION} ${REGISTRY} ${REGISTRY_ORG} ${IMAGE_PREFIX} ${PUSH}
|
|
318
|
+
fi
|
|
319
|
+
|
|
320
|
+
if [ "${GITHUB_BUILD}" == "true" ]; then
|
|
321
|
+
cp index.yaml tmp
|
|
322
|
+
fi
|
|
323
|
+
|
|
324
|
+
if [ "${BUILT}" == "true" ]; then
|
|
325
|
+
echo -e "${CYAN}${BOLD}${CHECK} One or more packages built${RESET}"
|
|
326
|
+
fi
|
|
327
|
+
|
|
328
|
+
# Clean up
|
|
329
|
+
rm -rf ${CHART_TMP}
|
|
330
|
+
|
|
331
|
+
if [ "${GITHUB_BUILD}" == "false" ]; then
|
|
332
|
+
rm -rf ${TMP}
|
|
333
|
+
fi
|
package/scripts/serve-pkgs
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
|
|
6
|
-
console.log(__dirname);
|
|
5
|
+
const { exit } = require('process');
|
|
7
6
|
|
|
8
7
|
const dir = path.resolve('.');
|
|
9
8
|
const pkgs = path.join(dir, 'dist-pkg');
|
|
10
9
|
let port = 4500;
|
|
11
10
|
|
|
11
|
+
if (!fs.existsSync(pkgs)) {
|
|
12
|
+
console.log(`\n\x1B[31m%s\x1B[0m\n`, `Error: The 'dist-pkg directory doesn't exist. You likely need to run the 'yarn build-pkg <pkg name>' command first.`);
|
|
13
|
+
exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
const express = require('express');
|
|
13
17
|
const serveStatic = require('serve-static');
|
|
14
18
|
|
|
@@ -91,6 +91,10 @@ ${SHELL_DIR}/scripts/publish-shell.sh
|
|
|
91
91
|
yarn build:lib
|
|
92
92
|
yarn publish:lib
|
|
93
93
|
|
|
94
|
+
# We pipe into cat for cleaner logging - we need to set pipefail
|
|
95
|
+
# to ensure the build fails in these cases
|
|
96
|
+
set -o pipefail
|
|
97
|
+
|
|
94
98
|
if [ "${SKIP_STANDALONE}" == "false" ]; then
|
|
95
99
|
DIR=$(mktemp -d)
|
|
96
100
|
pushd $DIR > /dev/null
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { getters } from '../index';
|
|
2
|
+
|
|
3
|
+
describe('getters', () => {
|
|
4
|
+
describe('namespaces', () => {
|
|
5
|
+
it('should return empty dictionary', () => {
|
|
6
|
+
const expectation = {};
|
|
7
|
+
const state = {};
|
|
8
|
+
const stateGetters = { currentProduct: () => ({}) };
|
|
9
|
+
|
|
10
|
+
const result = getters.namespaces(state, stateGetters)();
|
|
11
|
+
|
|
12
|
+
expect(result).toStrictEqual(expectation);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should return all the namespaces for related category', () => {
|
|
16
|
+
const clusterId = 'my-cluster';
|
|
17
|
+
const namespaceId = 'my-namespace';
|
|
18
|
+
const expectation = { [namespaceId]: true };
|
|
19
|
+
const state = {
|
|
20
|
+
allNamespaces: [{ id: namespaceId }],
|
|
21
|
+
prefs: { data: { 'all-namespaces': false } },
|
|
22
|
+
namespaceFilters: []
|
|
23
|
+
};
|
|
24
|
+
const stateGetters = {
|
|
25
|
+
isAllNamespaces: true,
|
|
26
|
+
currentProduct: { inStore: 'whatever' },
|
|
27
|
+
'whatever/all': {},
|
|
28
|
+
currentCluster: { id: clusterId },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const result = getters.namespaces(state, stateGetters)();
|
|
32
|
+
|
|
33
|
+
expect(result).toStrictEqual(expectation);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should return Rancher system namespaces', () => {
|
|
37
|
+
const clusterId = 'my-cluster';
|
|
38
|
+
const namespaceId = 'my-rancher-system-namespace';
|
|
39
|
+
const expectation = { [namespaceId]: true };
|
|
40
|
+
const state = {
|
|
41
|
+
allNamespaces: [{
|
|
42
|
+
id: namespaceId,
|
|
43
|
+
isObscure: true
|
|
44
|
+
}],
|
|
45
|
+
prefs: { data: { 'all-namespaces': true } },
|
|
46
|
+
namespaceFilters: []
|
|
47
|
+
};
|
|
48
|
+
const stateGetters = {
|
|
49
|
+
isAllNamespaces: true,
|
|
50
|
+
currentProduct: { inStore: 'whatever' },
|
|
51
|
+
'whatever/all': {},
|
|
52
|
+
currentCluster: { id: clusterId },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const result = getters.namespaces(state, stateGetters)();
|
|
56
|
+
|
|
57
|
+
expect(result).toStrictEqual(expectation);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should filter Rancher system namespaces', () => {
|
|
61
|
+
const clusterId = 'my-cluster';
|
|
62
|
+
const namespaceId = 'my-rancher-system-namespace';
|
|
63
|
+
const expectation = { };
|
|
64
|
+
const state = {
|
|
65
|
+
allNamespaces: [{
|
|
66
|
+
id: namespaceId,
|
|
67
|
+
isObscure: true
|
|
68
|
+
}],
|
|
69
|
+
prefs: { data: { 'all-namespaces': false } },
|
|
70
|
+
namespaceFilters: []
|
|
71
|
+
};
|
|
72
|
+
const stateGetters = {
|
|
73
|
+
isAllNamespaces: true,
|
|
74
|
+
currentProduct: { inStore: 'whatever' },
|
|
75
|
+
'whatever/all': {},
|
|
76
|
+
currentCluster: { id: clusterId },
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const result = getters.namespaces(state, stateGetters)();
|
|
80
|
+
|
|
81
|
+
expect(result).toStrictEqual(expectation);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should filter namespaces by project', () => {
|
|
85
|
+
const clusterId = 'my-cluster';
|
|
86
|
+
const namespaceId = 'my-product-namespace';
|
|
87
|
+
const projectId = 'my-project';
|
|
88
|
+
const expectation = { [namespaceId]: true };
|
|
89
|
+
const state = {
|
|
90
|
+
allNamespaces: [{ id: namespaceId }],
|
|
91
|
+
prefs: { data: { 'all-namespaces': false } },
|
|
92
|
+
namespaceFilters: [`project://${ projectId }`]
|
|
93
|
+
};
|
|
94
|
+
const stateGetters = {
|
|
95
|
+
isAllNamespaces: false,
|
|
96
|
+
currentProduct: { inStore: 'whatever' },
|
|
97
|
+
'whatever/all': {},
|
|
98
|
+
'management/byId': () => ({
|
|
99
|
+
id: projectId,
|
|
100
|
+
namespaces: [{ id: namespaceId }]
|
|
101
|
+
}),
|
|
102
|
+
currentCluster: { id: clusterId },
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const result = getters.namespaces(state, stateGetters)();
|
|
106
|
+
|
|
107
|
+
expect(result).toStrictEqual(expectation);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|