Skip to content

Commit

Permalink
Merge branch 'release/2.6.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Oct 11, 2023
2 parents 838e4a9 + 083b825 commit 35a66de
Show file tree
Hide file tree
Showing 13 changed files with 1,141 additions and 982 deletions.
2 changes: 2 additions & 0 deletions client-programs/pkg/renderer/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ func generateHugoConfiguration(workshopDir string, target string, params map[str
}
}

params["__first_page__"] = ""

pathway, pathwayExists := workshopConfig.Pathways.Paths[pathwayName]

if pathwayName != "" && pathwayExists && len(pathway.Steps) != 0 {
Expand Down
1,950 changes: 993 additions & 957 deletions docker-extension/ui/package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions docker-extension/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"@docker/extension-api-client": "0.3.4",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@mui/icons-material": "^5.14.8",
"@mui/lab": "^5.0.0-alpha.143",
"@mui/material": "^5.14.8",
"@mui/icons-material": "^5.14.12",
"@mui/lab": "^5.0.0-alpha.147",
"@mui/material": "^5.14.12",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand All @@ -21,13 +21,13 @@
},
"devDependencies": {
"@docker/extension-api-client-types": "0.3.4",
"@types/jest": "^29.1.2",
"@types/node": "^18.7.18",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^2.1.0",
"jest": "^29.1.2",
"typescript": "^4.8.3",
"vite": "^3.1.0"
"@types/jest": "^29.5.5",
"@types/node": "^20.8.4",
"@types/react": "^18.2.27",
"@types/react-dom": "^18.2.12",
"@vitejs/plugin-react": "^4.1.0",
"jest": "^29.7.0",
"typescript": "^5.2.2",
"vite": "^4.4.11"
}
}
}
1 change: 1 addition & 0 deletions project-docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Educates
:maxdepth: 2
:caption: Release Notes:

release-notes/version-2.6.16
release-notes/version-2.6.15
release-notes/version-2.6.14
release-notes/version-2.6.13
Expand Down
2 changes: 1 addition & 1 deletion project-docs/project-details/project-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Although the principal deployment platform for Educates is Kubernetes, and is be
Latest project version
----------------------

The latest release of Educates is version 2.6.15.
The latest release of Educates is version 2.6.16.

Source code repositories
------------------------
Expand Down
37 changes: 37 additions & 0 deletions project-docs/release-notes/version-2.6.16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Version 2.6.16
==============

New Features
------------

* In special case where the workshop base image was being used to run services
in a separate deployment from the workshop pod, using the default command for
the image, it is now possible to set the `SUPERVISOR_ONLY` environment
variable. This will have the affect of ensuring the gateway process which runs
the workshop dashboard, and other processes such as the editor and console are
not run, unless explicitly enabled by respective environment variables.
Further, in this mode, if an error occurs in downloading files using `vendir`
or when running setup scripts, the start script for the container will be
exited, with the result that the pod will be restarted, instead of ignoring
the errors and continuing on to running the process supervisor.

Features Changed
----------------

* Examiner functionality was incorrectly enabled by default in the workshop base
image. If a workshop had inadvertantly been making use of this it may now
fail, in which case it should explicitly enable the examiner feature in the
workshop defintion as was originally intended to be done.

* If the Hugo renderer is being used, and there are no workshop instructions
or an error occurs when rendering the instructions, a default page will be
shown in the workshop instructions with a warning that an error occurred,
rather than showing a HTTP page not found error.

Bugs Fixed
----------

* When an error occured rendering workshop instructions using the Hugo renderer,
the details were not logged to the `setup-scripts.log` file accessible from
inside of the workshop container, and were only visible by using `kubectl log`
on the pod corresponding to the workshop container.
24 changes: 15 additions & 9 deletions workshop-images/base-environment/opt/eduk8s/bin/rebuild-content
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ fi

YTT_ARGS+=(-f $HOME/.local/share/workshop/workshop-environment.json --file-mark workshop-environment.json:type=data)

if [ -f $WORKSHOP_DIR/config.yaml ]; then
if [ x"$WORKSHOP_DIR" != x"" -a -f $WORKSHOP_DIR/config.yaml ]; then
YTT_ARGS+=(-f $WORKSHOP_DIR/config.yaml --file-mark config.yaml:path=workshop-configuration.yaml --file-mark config.yaml:type=data)
fi

ytt -f /opt/eduk8s/etc/templates/workshop-variables.yaml "${YTT_ARGS[@]}" -o json >$HOME/.local/share/workshop/workshop-variables.json

# Bail out if workshop instructions are disabled.
# Bail out if workshop instructions are disabled or no content directory.

if [ x"$ENABLE_WORKSHOP" != x"true" ]; then
if [ x"$ENABLE_WORKSHOP" != x"true" -o x"$WORKSHOP_DIR" == x"" ]; then
exit 0
fi

Expand All @@ -71,7 +71,9 @@ fi

ytt -f /opt/eduk8s/etc/templates/hugo-configuration.yaml "${YTT_ARGS[@]}" >$HOME/.local/share/workshop/hugo-configuration.yaml

# Run Hugo to generate static HTML files.
# Run Hugo to generate static HTML files. We run it twice, once to generate
# with empty set of documents so that we still get something even if real run
# fails for some reason, then the real run.

HUGO_ARGS=()

Expand All @@ -80,15 +82,19 @@ HUGO_ARGS+=(--cleanDestinationDir)

HUGO_ARGS+=(--minify)

HUGO_ARGS+=(--configDir $WORKSHOP_DIR/config)
HUGO_ARGS+=(--config $HOME/.local/share/workshop/hugo-configuration.yaml)

HUGO_ARGS+=(--source $WORKSHOP_DIR)
HUGO_ARGS+=(--destination $WORKSHOP_DIR/public)

HUGO_ARGS+=(--themesDir /opt/eduk8s/etc/themes)
HUGO_ARGS+=(--theme educates)

HUGO_ARGS+=(--baseURL $INGRESS_PROTOCOL://$SESSION_NAMESPACE.$INGRESS_DOMAIN$INGRESS_PORT_SUFFIX/workshop/content/)

hugo "${HUGO_ARGS[@]}"
TEMPDIR=/tmp/dummy-workshop.$$

mkdir $TEMPDIR

trap "rm -rf $TEMPDIR" EXIT

hugo "${HUGO_ARGS[@]}" --source $TEMPDIR --destination $WORKSHOP_DIR/public || true

hugo "${HUGO_ARGS[@]}" --source $WORKSHOP_DIR
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ fi

export LOCAL_RENDERER_TYPE

rebuild-content || touch $SETUP_FAILED
(rebuild-content || touch $SETUP_FAILED) 2>&1 | tee -a $SETUP_LOGFILE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ else
else
if [ -d /opt/eduk8s/workshop ]; then
WORKSHOP_DIR=/opt/eduk8s/workshop
else
mkdir -p /opt/workshop
WORKSHOP_DIR=/opt/workshop
fi
fi
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ stopsignal=TERM
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
autostart=%(ENV_ENABLE_GATEWAY)s
autorestart=true
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
#@ if first_page:
#@ params["__first_page__"] = first_page
#@ params["__modules__"] = active_modules
#@ else:
#@ params["__first_page__"] = ""
#@ params["__modules__"] = {}
#@ end

params: #@ params
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@
<div class="row">
<div class="col-sm-12">
<section class="page-content" id="main">
{{ if $first_page }}
<script>
window.location.replace('{{ relURL $first_page }}')
</script>
{{ else }}
<div class="admonition danger">
<p class="admonition-title">Renderer Failed</p>
<p>An unknown error occured preparing the workshop and no workshop instructions were found. Check available workshop error logs for details.</p>
</div>
{{ if .Param "restart_url" }}
<div class="page-meta clearfix">
<form>
<button class="btn btn-lg btn-primary float-right" id="next-page" type="button" aria-label="finish"
onclick="educates.finished_workshop()">
Terminate Session </button>
</form>
</div>
{{ end }}
{{ end }}
</section>
</div>
</div>
Expand Down
58 changes: 56 additions & 2 deletions workshop-images/base-environment/opt/eduk8s/sbin/start-container
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export INGRESS_PORT
DOWNLOAD_LOGFILE=$HOME/.local/share/workshop/download-workshop.log
DOWNLOAD_FAILED=$HOME/.local/share/workshop/download-workshop.failed

SETUP_LOGFILE=$HOME/.local/share/workshop/setup-scripts.log
SETUP_FAILED=$HOME/.local/share/workshop/setup-scripts.failed

if [ -f /opt/eduk8s/config/vendir-assets-01.yaml -o -f /opt/eduk8s/config/vendir-packages.yaml ]; then
if [ ! -f /opt/assets/vendir-assets-01.yaml -a ! -f /opt/packages/vendir-packages.yaml ]; then
# In this case we are running in the main container and need to do the
Expand Down Expand Up @@ -114,12 +117,18 @@ fi
# than the original YAML, so environment variables can be used to override YAML
# values if necessary.

SUPERVISOR_ONLY=${SUPERVISOR_ONLY:-false}
WORKSHOP_ONLY=${WORKSHOP_ONLY:-false}
TERMINAL_ONLY=${TERMINAL_ONLY:-false}

ENABLE_GATEWAY=${ENABLE_GATEWAY:-true}

ENABLE_DASHBOARD=${ENABLE_DASHBOARD:-true}

ENABLE_CONSOLE=${ENABLE_CONSOLE:-$(application-enabled console false)}
ENABLE_DOCKER=${ENABLE_DOCKER:-$(application-enabled docker false)}
ENABLE_EDITOR=${ENABLE_EDITOR:-$(application-enabled editor false)}
ENABLE_EXAMINER=${ENABLE_EXAMINER:-$(application-enabled examiner true)}
ENABLE_EXAMINER=${ENABLE_EXAMINER:-$(application-enabled examiner false)}
ENABLE_GIT=${ENABLE_GIT:-$(application-enabled git false)}
ENABLE_FILES=${ENABLE_FILES:-$(application-enabled files false)}
ENABLE_REGISTRY=${ENABLE_REGISTRY:-$(application-enabled registry false)}
Expand All @@ -131,7 +140,30 @@ ENABLE_VCLUSTER=${ENABLE_VCLUSTER:-$(application-enabled vcluster false)}
ENABLE_WEBDAV=${ENABLE_WEBDAV:-$(application-enabled webdav false)}
ENABLE_WORKSHOP=${ENABLE_WORKSHOP:-$(application-enabled workshop true)}

if [ x"$SUPERVISOR_ONLY" == x"true" ]; then
ENABLE_GATEWAY=false

ENABLE_DASHBOARD=false

ENABLE_CONSOLE=false
ENABLE_DOCKER=false
ENABLE_EDITOR=false
ENABLE_EXAMINER=false
ENABLE_FILES=false
ENABLE_GIT=false
ENABLE_REGISTRY=false
ENABLE_SLIDES=false
ENABLE_SSHD=false
ENABLE_TERMINAL=false
ENABLE_UPLOADS=false
ENABLE_VCLUSTER=false
ENABLE_WEBDAV=false
ENABLE_WORKSHOP=false
fi

if [ x"$WORKSHOP_ONLY" == x"true" ]; then
ENABLE_GATEWAY=true

ENABLE_DASHBOARD=false

ENABLE_CONSOLE=false
Expand All @@ -153,6 +185,8 @@ if [ x"$WORKSHOP_ONLY" == x"true" ]; then
fi

if [ x"$TERMINAL_ONLY" == x"true" ]; then
ENABLE_GATEWAY=true

ENABLE_DASHBOARD=false

ENABLE_CONSOLE=false
Expand All @@ -173,6 +207,12 @@ if [ x"$TERMINAL_ONLY" == x"true" ]; then
DEFAULT_PAGE=terminal
fi

export SUPERVISOR_ONLY
export WORKSHOP_ONLY
export TERMINAL_ONLY

export ENABLE_GATEWAY

export ENABLE_DASHBOARD

export ENABLE_CONSOLE
Expand Down Expand Up @@ -235,6 +275,10 @@ INGRESS_CLASS="$INGRESS_CLASS"
STORAGE_CLASS="$STORAGE_CLASS"
POLICY_ENGINE="$POLICY_ENGINE"
POLICY_NAME="$POLICY_NAME"
SUPERVISOR_ONLY="$SUPERVISOR_ONLY"
WORKSHOP_ONLY="$WORKSHOP_ONLY"
TERMINAL_ONLY="$TERMINAL_ONLY"
ENABLE_GATEWAY="$ENABLE_GATEWAY"
ENABLE_DASHBOARD="$ENABLE_DASHBOARD"
ENABLE_CONSOLE="$ENABLE_CONSOLE"
ENABLE_DOCKER="$ENABLE_DOCKER"
Expand Down Expand Up @@ -267,10 +311,20 @@ EOF
fi

# Rebuild the workshop environment within the container, including generating
# any static workshop instructions if using the Hugo renderer.
# any static workshop instructions if using the Hugo renderer. If supervisor
# only mode was enabled, we will exit startup if there is a failure, causing
# the whole container to exit and potentially restart.

if [ x"$SUPERVISOR_ONLY" == x"true" -a -f $DOWNLOAD_FAILED ]; then
exit 1
fi

. /opt/eduk8s/bin/rebuild-workshop

if [ x"$SUPERVISOR_ONLY" == x"true" -a -f $SETUP_FAILED ]; then
exit 1
fi

# Run supervisord. See /opt/eduk8s/etc/supervisord.conf for the main
# configuration. This is also symlinked to /etc/supervisord.conf so that
# supervisorctl can find it without needing to provide a command line argument
Expand Down

0 comments on commit 35a66de

Please sign in to comment.