From 32f3be1d32364012c162f664e4a5bf73d59f0ef0 Mon Sep 17 00:00:00 2001 From: Evan Shortiss Date: Mon, 12 Jun 2023 16:16:04 -0700 Subject: [PATCH] chore: customise instructions to remove summit refs --- docs/modules/m1-overview/pages/setup.adoc | 32 ++++++-- lib/tabs.js | 99 +++++++++++++++++++++++ site-gh-pages.yml | 2 + site.yml | 2 + 4 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 lib/tabs.js diff --git a/docs/modules/m1-overview/pages/setup.adoc b/docs/modules/m1-overview/pages/setup.adoc index 55f9e72..49c42a8 100644 --- a/docs/modules/m1-overview/pages/setup.adoc +++ b/docs/modules/m1-overview/pages/setup.adoc @@ -44,20 +44,29 @@ You should now have a copy of the repository at a unique URL of your own at `htt == Access your OpenShift Cluster +You'll be using your own OpenShift cluster throughout this workshop. Your cluster will be configured with the **OpenShift Web Terminal** and **Red Hat OpenShift GitOps** Operators. You can think of Operators as addons to an OpenShift or Kubernetes cluster that provide it with extended features/capabilities: + + * The **Web Terminal** makes it easy to use pre-authenticated command-line tools (CLIs) to interact with the OpenShift APIs directly from the **OpenShift Web Console** in your web browser. + * The **Red Hat OpenShift GitOps** operator provides a managed an Argo CD instance on OpenShift. + +[tabs, subs="attributes+,+macros"] +==== +OpenShift (Provided by a Workshop Host):: ++ +-- +If you're attending this workshop as part of a hosted session, then continue reading this section. If you need to self-host an environment for this workshop then switch to the *Custom OpenShift* tab. + You'll be using your own OpenShift cluster throughout this workshop. Your cluster is pre-configured with the **OpenShift Web Terminal** and **Red Hat OpenShift GitOps** Operators. You can think of Operators as addons to an OpenShift or Kubernetes cluster that provide it with extended features/capabilities: * The **Web Terminal** makes it easy to use pre-authenticated command-line tools (CLIs) to interact with the OpenShift APIs directly from the **OpenShift Web Console** in your web browser. * Pre-installing the **Red Hat OpenShift GitOps** operator saved a few minutes of time so you can fully focus on actually learning about GitOps instead of setting it up! -To retrieve your cluster's information: +You likely already accessed these instructions via a unique https://demo.redhat.com[demo.redhat.com] URL, e.g `https://demo.redhat.com/workshop/$WORKSHOP_ID`. If so, return to that URL and: -. Visit the https://summit.demo.redhat.com[summit.demo.redhat.com]. -. Enter your email address and the password provided by the workshop administrator(s). +. Enter your email address, and the password provided by the workshop administrator(s). + [IMPORTANT] -==== Use your actual email address. This is so you can use the same email and password again to access your cluster information if you lose access, or forget the cluster details. -==== + image:ex1.demo-redhat-login.png[] . Click the *Access this workshop* button. @@ -72,9 +81,20 @@ To access your OpenShift cluster's *Web Console*: . Visit the cluster URL in a web browser, and select the *htpasswd_provider* login option when prompted. + image:ex1.openshift-login-screen.png[] -. Login to your OpenShift cluster using the *Admin* username and password provided by https://summit.demo.redhat.com[summit.demo.redhat.com]. +. Login to your OpenShift cluster using the *Admin* username and password provided by the https://demo.redhat.com[demo.redhat.com] page. The **Overview** page of the OpenShift Web Console is displayed after a successful login. From here you can perform both administrative and developer-focused tasks. +-- +Custom OpenShift:: ++ +-- + +Use the instructions in the https://github.com/redhat-scholars/summit-2023-gitops-lab-guide#lab-environment-setup[Using your own Environment section of this repository] to prepare your OpenShift environment for this workshop. + +Move onto the next section once the OpenShift environment has been configured. + +-- +==== == Access the OpenShift Web Terminal diff --git a/lib/tabs.js b/lib/tabs.js new file mode 100644 index 0000000..972dc9e --- /dev/null +++ b/lib/tabs.js @@ -0,0 +1,99 @@ +/* Copyright (c) 2018 OpenDevise, Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Extends the AsciiDoc syntax to support a tabset. The tabset is created from + * a dlist enclosed in an example block that is marked with the tabs style. + * + * Usage: + * + * [tabs] + * ==== + * Tab A:: + * + + * -- + * Contents of tab A. + * -- + * Tab B:: + * + + * -- + * Contents of tab B. + * -- + * ==== + * + * @author Dan Allen + */ +const IdSeparatorCh = "-"; +const ExtraIdSeparatorsRx = /^-+|-+$|-(-)+/g; +const InvalidIdCharsRx = /[^a-zA-Z0-9_]/g; +const List = Opal.const_get_local(Opal.module(null, "Asciidoctor"), "List"); +const ListItem = Opal.const_get_local( + Opal.module(null, "Asciidoctor"), + "ListItem" +); + +const generateId = (str, idx) => + `tabset${idx}_${str + .toLowerCase() + .replace(InvalidIdCharsRx, IdSeparatorCh) + .replace(ExtraIdSeparatorsRx, "$1")}`; + +function tabsBlock() { + this.onContext("example"); + this.process((parent, reader, attrs) => { + const createHtmlFragment = html => this.createBlock(parent, "pass", html); + const tabsetIdx = parent.getDocument().counter("idx-tabset"); + const nodes = []; + nodes.push(createHtmlFragment('
')); + const container = this.parseContent( + this.createBlock(parent, "open"), + reader + ); + const sourceTabs = container.getBlocks()[0]; + if ( + !( + sourceTabs && + sourceTabs.getContext() === "dlist" && + sourceTabs.getItems().length + ) + ) + return; + const tabs = List.$new(parent, "ulist"); + tabs.addRole("tabs"); + const panes = {}; + sourceTabs.getItems().forEach(([[title], details]) => { + const tab = ListItem.$new(tabs); + tabs.$append(tab); + const id = generateId(title.getText(), tabsetIdx); + tab.text = `[[${id}]]${title.text}`; + let blocks = details.getBlocks(); + const numBlocks = blocks.length; + if (numBlocks) { + if (blocks[0].context === "open" && numBlocks === 1) + blocks = blocks[0].getBlocks(); + panes[id] = blocks.map(block => (block.parent = parent) && block); + } + }); + nodes.push(tabs); + nodes.push(createHtmlFragment('
')); + Object.entries(panes).forEach(([id, blocks]) => { + nodes.push( + createHtmlFragment(`
`) + ); + nodes.push(...blocks); + nodes.push(createHtmlFragment("
")); + }); + nodes.push(createHtmlFragment("
")); + nodes.push(createHtmlFragment("
")); + parent.blocks.push(...nodes); + }); +} + +function register(registry, context) { + registry.block("tabs", tabsBlock); +} + +module.exports.register = register; \ No newline at end of file diff --git a/site-gh-pages.yml b/site-gh-pages.yml index 162f55c..1250268 100644 --- a/site-gh-pages.yml +++ b/site-gh-pages.yml @@ -14,6 +14,8 @@ asciidoc: attributes: experimental: true page-pagination: true + extensions: + - ./lib/tabs.js ui: bundle: diff --git a/site.yml b/site.yml index 6336c1e..686525e 100644 --- a/site.yml +++ b/site.yml @@ -13,6 +13,8 @@ asciidoc: attributes: experimental: true page-pagination: true + extensions: + - ./lib/tabs.js ui: bundle: