Skip to content

Commit e9524ce

Browse files
authored
Merge pull request #1 from wking/template-seed
Bring in console-plugin-template template content
2 parents 86f0e8a + 5128e1d commit e9524ce

57 files changed

Lines changed: 17778 additions & 0 deletions

Some content is hidden

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

.ci-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build_root_image:
2+
name: console-plugin-test-cypress
3+
namespace: ci
4+
tag: node22

.devcontainer/Dockerfile.console

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM quay.io/openshift/origin-console:latest
2+
COPY --from=openshift/origin-cli:latest /usr/bin/oc /usr/local/bin/oc
3+
4+
ENV OC_URL=$OC_URL
5+
ENV OC_PASS=$OC_PASS
6+
ENV OC_USER=$OC_USER
7+
ENV OC_PLUGIN_NAME=$OC_PLUGIN_NAME
8+
9+
USER root
10+
CMD eval "oc login $OC_URL -u $OC_USER -p $OC_PASS --insecure-skip-tls-verify" && \
11+
/opt/bridge/bin/bridge -public-dir=/opt/bridge/static \
12+
-i18n-namespaces plugin__$OC_PLUGIN_NAME \
13+
-plugins $OC_PLUGIN_NAME=http://localhost:9001 \
14+
-k8s-mode-off-cluster-thanos=$(oc -n openshift-config-managed get configmap monitoring-shared-config -o jsonpath='{.data.thanosPublicURL}') \
15+
-k8s-mode-off-cluster-endpoint=$(oc whoami --show-server) \
16+
-k8s-mode-off-cluster-skip-verify-tls=true \
17+
-k8s-auth-bearer-token=$(oc whoami --show-token) \
18+
-k8s-auth="bearer-token" \
19+
-user-auth="disabled" \
20+
-k8s-mode="off-cluster"

.devcontainer/Dockerfile.plugin

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:16 as build
2+
COPY --from=openshift/origin-cli:latest /usr/bin/oc /usr/local/bin/oc

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Console + Plugin",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "plugin",
5+
"workspaceFolder": "/workspace",
6+
7+
"initializeCommand": ".devcontainer/init.sh",
8+
"postCreateCommand": "yarn && eval 'oc login $OC_URL -u $OC_USER -p $OC_PASS --insecure-skip-tls-verify'",
9+
"forwardPorts": [9000, 9001],
10+
"portsAttributes": {
11+
"9000": {
12+
"label": "Console"
13+
},
14+
"9001": {
15+
"label": "Plugin static files",
16+
"onAutoForward": "silent"
17+
}
18+
},
19+
"features": {},
20+
"customizations": {
21+
"vscode": {
22+
"settings": {},
23+
"extensions": [
24+
"ms-azuretools.vscode-docker",
25+
"ms-vscode.vscode-typescript-next",
26+
"dbaeumer.vscode-eslint",
27+
"esbenp.prettier-vscode"
28+
]
29+
}
30+
}
31+
}

.devcontainer/docker-compose.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3.8'
2+
# create dev.env with the following values:
3+
# OC_URL
4+
# OC_USER
5+
# OC_PASS
6+
# OC_PLUGIN_NAME
7+
services:
8+
console:
9+
build:
10+
context: ..
11+
dockerfile: .devcontainer/Dockerfile.console
12+
env_file: dev.env
13+
restart: unless-stopped
14+
healthcheck:
15+
test: oc whoami
16+
interval: 1m30s
17+
timeout: 10s
18+
retries: 5
19+
20+
plugin:
21+
build:
22+
context: ..
23+
dockerfile: .devcontainer/Dockerfile.plugin
24+
env_file: dev.env
25+
depends_on:
26+
- console
27+
network_mode: service:console
28+
# Overrides default command so things don't shut down after the process ends.
29+
command: sleep infinity
30+
# Cache local workspace and copy shell history.
31+
volumes:
32+
- ..:/workspace:cached
33+
- ~/.bash_history:/root/.bash_history
34+
- ~/.zsh_history:/root/.zsh_history

.devcontainer/init.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
if [[ ! -f .devcontainer/dev.env ]]
4+
then
5+
cat << EOF
6+
env file 'dev.env' does not exist in .devcontainer, please create it and add the the correct values for your cluster.
7+
OC_PLUGIN_NAME=my-plugin
8+
OC_URL=https://api.example.com:6443
9+
OC_USER=kubeadmin
10+
OC_PASS=<password>
11+
EOF
12+
exit 2
13+
else
14+
echo 'found 'dev.env' in .devcontainer'
15+
fi
16+
17+
# if one of the variables are missing, abort the build.
18+
success=1
19+
! grep -q OC_PLUGIN_NAME= ".devcontainer/dev.env" && success=0
20+
! grep -q OC_URL= ".devcontainer/dev.env" && success=0
21+
! grep -q OC_USER= ".devcontainer/dev.env" && success=0
22+
! grep -q OC_PASS= ".devcontainer/dev.env" && success=0
23+
24+
if ((success)); then
25+
echo 'dev.env is formatted correctly, proceeding.'
26+
else
27+
cat << EOF
28+
dev.env is not formatted correctly, please add the the correct values for your cluster.
29+
OC_PLUGIN_NAME=my-plugin
30+
OC_URL=https://api.example.com:6443
31+
OC_USER=kubeadmin
32+
OC_PASS=<password>
33+
EOF
34+
exit 2
35+
fi

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
**/node_modules
2+
**/dist
3+
**/.DS_Store
4+
.devcontainer/dev.env
5+
integration-tests/videos
6+
integration-tests/screenshots
7+
8+
# Yarn v4 (Berry)
9+
.yarn/*
10+
install-state.gz
11+
!.yarn/patches
12+
!.yarn/plugins
13+
!.yarn/releases
14+
!.yarn/sdks
15+
!.yarn/versions

.prettierrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
arrowParens: always
2+
printWidth: 100
3+
singleQuote: true
4+
trailingComma: all

.stylelintrc.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
extends:
2+
- stylelint-config-standard
3+
rules:
4+
# Disallow custom colors as these don't work well with dark mode.
5+
# Use PF semantic tokens instead:
6+
# https://www.patternfly.org/tokens/all-patternfly-tokens
7+
color-named: never
8+
color-no-hex: true
9+
function-disallowed-list:
10+
- rgb
11+
- rgba
12+
- hsl
13+
- hsla
14+
- oklch
15+
- oklch
16+
- hwb
17+
- lab
18+
- lch
19+
# PatternFly CSS vars don't conform to stylelint's regex. Disable this rule.
20+
custom-property-pattern: null
21+
# Disable the standard rule to allow BEM-style class names with underscores.
22+
selector-class-pattern: null
23+
# Disallow CSS class names prefixed with .pf- or .co- as these prefixes are
24+
# reserved by PatternFly and OpenShift console.
25+
selector-disallowed-list:
26+
- "*"
27+
- /\.(pf|co)-/
28+
# Plugins should avoid naked element selectors like `table` and `li` since
29+
# this can impact layout of existing pages in console.
30+
selector-max-type:
31+
- 0
32+
- ignore:
33+
- compounded
34+
- descendant

.vscode/settings.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"typescript.tsdk": "./node_modules/typescript/lib",
3+
"editor.formatOnSave": false,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": "explicit",
6+
"source.fixAll.ts": "explicit"
7+
},
8+
"search.exclude": {
9+
"**/node_modules": true
10+
},
11+
"files.watcherExclude": {
12+
"**/node_modules/**": true
13+
},
14+
"files.associations": {
15+
"**/console-extensions.json": "jsonc"
16+
},
17+
"json.schemas": [
18+
{
19+
"fileMatch": ["**/console-extensions.json"],
20+
"url": "./node_modules/@openshift-console/dynamic-plugin-sdk-webpack/schema/console-extensions.json"
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)