Skip to content

Commit

Permalink
Migrate to antora
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Nov 15, 2023
1 parent 0d51772 commit 4a34b60
Show file tree
Hide file tree
Showing 79 changed files with 11,702 additions and 43 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: GitHub Pages Publish
on:
push:
branches: [ main ]
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -15,17 +16,14 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Includes the AsciiDoctor GitHub Pages Action to convert adoc files to html and publish to gh-pages branch
- name: asciidoctor-ghpages
uses: manoelcampos/asciidoctor-ghpages-action@v2.2.4
- uses: actions/checkout@v4
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- run: npm run install-build
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
pdf_build: true
# asciidoctor_params: --attribute=nofooter
# adoc_file_ext: .ascii # default is .adoc
# source_dir: docs/ # default is .
# slides_build: true
# pre_build:
# post_build:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/site
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/build
/node_modules
*.html
28 changes: 8 additions & 20 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,18 @@
__Unofficial__ documentation for OpenShift Pipelines maintained by the
engineers working on the project.

== The Operator xref:operator/index.adoc[➡]
== The Operator xref:operator:index.adoc[➡]

- xref:operator/troubleshooting.adoc[Troubleshooting]
- xref:operator/install-result.adoc[Installing Result]
- xref:operator/high-availability.adoc[High Availability for Tekton Pipelines Controller]
- xref:operator:troubleshooting.adoc[Troubleshooting]

== Pipeline xref:pipeline/index.adoc[➡]
== Pipeline xref:pipeline:index.adoc[➡]

- xref:pipeline/auth.adoc[Authentication practices with Tekton]
- xref:pipeline/hardened.adoc[Hardened your Pipelines and Tasks]
- xref:pipeline/unprivileged-builds.adoc[Build container image with buildah, unprivileged]
- xref:pipeline/cache-in-tekton.adoc[Caches "support" in tekton pipelines]

== Results xref:results/index.adoc[➡]

- xref:results/query-using-opc.adoc[Query Results Using OPC CLI]

== Chains xref:chains/index.adoc[➡]

- xref:chains/hashicorp-integration-with-chains.adoc[Hashicorp Integration with Tekton Chains
]

== Triggers xref:triggers/index.adoc[➡]
- xref:pipeline:auth.adoc[Authentication practices with Tekton]
- xref:pipeline:hardened.adoc[Hardened your Pipelines and Tasks]
- xref:pipeline:unprivileged-builds.adoc[Build container image with buildah, unprivileged]
- xref:pipeline:cache-in-tekton.adoc[Caches "support" in tekton pipelines]

== Pipeline as code https://pipelinesascode.com/[➡]


The upstream documentation for Pipeline as code is very good, so let's just go there: https://pipelinesascode.com/[pipelinesascode.com]
3 changes: 3 additions & 0 deletions _headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# We could switch to /_/* and use an indefinite age if we append a cache buster to all asset URLs
/_/font/*
Cache-Control: public,max-age=604800
27 changes: 27 additions & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
site:
title: Red Hat OpenShift Pipelines previews
url: https://docs.openshift-pipelines.org
start_page: docs::index.adoc
urls:
latest_version_segment: latest
content:
sources:
- url: .
edit_url: ~
branches: HEAD
ui:
bundle:
url: ./ui-bundle.zip
supplemental_files: ./supplemental_ui

asciidoc:
extensions:
- asciidoctor-emoji
- ./lib/tabs
attributes:
hide-uri-scheme: ''
product-name: 'OpenShift Pipelines'
short-name: 'Pipelines'
pipelines: 'OpenShift Pipelines'
toc: preamble
toc-title: ~
13 changes: 13 additions & 0 deletions antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: docs
title: Documentation
version: main
nav:
- modules/ROOT/nav.adoc
start_ROOT: 'ROOT:index.adoc'
asciidoc:
attributes:
product-title: OpenShift
pipelinesoperatorname: OpenShift Pipelines Operator
pipelinesproductname: OpenShift Pipelines
serverlessoperatorname: OpenShift Pipelines Operator
product_name: OpenShift Pipelines
37 changes: 37 additions & 0 deletions lib/copy-to-clipboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const BlockCopyToClipboardMacro = (() => {
const $context = Symbol("context");
const superclass = Opal.module(null, "Asciidoctor").Extensions
.BlockMacroProcessor;
const scope = Opal.klass(
Opal.module(null, "Antora"),
superclass,
"BlockCopyToClipboardMacro",
function() {}
);

Opal.defn(scope, "$initialize", function initialize(name, config, context) {
Opal.send(
this,
Opal.find_super_dispatcher(this, "initialize", initialize),
[name, config]
);
this[$context] = context;
});

Opal.defn(scope, "$process", function(parent, target, attrs) {
const t = target.startsWith(":") ? target.substr(1) : target;
//console.log("target:", t);
const createHtmlFragment = html => this.createBlock(parent, "pass", html);
const html = `<button class="copybtn" title="Copy to clipboard" data-clipboard-target="#${t}"><i class="fa fa-copy"></i></button><br/>`;
parent.blocks.push(createHtmlFragment(html));
});

return scope;
})();

module.exports.register = (registry, context) => {
registry.blockMacro(
BlockCopyToClipboardMacro.$new("copyToClipboard", Opal.hash(), context)
);
};

76 changes: 76 additions & 0 deletions lib/tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Extends the AsciiDoc syntax to support a tabset element. The tabset is
* created from a dlist that is enclosed in an example block marked with the
* tabs style.
*
* Usage:
*
* [tabs]
* ====
* Tab A::
* +
* --
* Contents of tab A.
* --
* Tab B::
* +
* --
* Contents of tab B.
* --
* ====
*
* To use this extension, register the tabs.js file with Antora (i.e.,
* list it as an AsciiDoc extension in the Antora playbook file), combine
* styles.css with the styles for the site, and combine behavior.js with the
* JavaScript loaded by the page.
*
* @author Dan Allen <dan@opendevise.com>
*/
const IdSeparatorChar = '-'
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, IdSeparatorChar)}`

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('<div class="tabset is-loading">'))
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('<div class="content">'))
Object.entries(panes).forEach(([id, blocks]) => {
nodes.push(createHtmlFragment(`<div class="tab-pane" aria-labelledby="${id}">`))
nodes.push(...blocks)
nodes.push(createHtmlFragment('</div>'))
})
nodes.push(createHtmlFragment('</div>'))
nodes.push(createHtmlFragment('</div>'))
parent.blocks.push(...nodes)
})
}

module.exports.register = (registry, context) => {
registry.block('tabs', tabsBlock)
}
11 changes: 11 additions & 0 deletions modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* xref:index.adoc[Overview]
* Pipelines
** xref:pipeline:auth.adoc[Authentication practices with Tekton]
** xref:pipeline:unprivileged-builds.adoc[Build container image with buildah, unprivileged]
** xref:pipeline:cache-in-tekton.adoc[Caches "support" in tekton pipelines]
* Operator
** xref:operator:troubleshooting.adoc[Troubleshooting]
* Results
** xref:results:query-using-opc.adoc[Query Results Using OPC CLI]
* Chains
** xref:chains:hashicorp-integration-with-chains.adoc[Hashicorp Integration with Tekton Chains]
3 changes: 3 additions & 0 deletions modules/ROOT/pages/_attributes.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:moduledir: ..
:branch: main
:github-repo: https://github.com/openshift-pipelines/docs.git
7 changes: 7 additions & 0 deletions modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
= Overview

IMPORTANT: This is an __nofficial__ documentation for OpenShift Pipelines maintained by the engineers working on the project. Please refer to the https://docs.openshift.com[Official documentation] for supported documentation.

== Pipeline as code https://pipelinesascode.com/[➡]

The upstream documentation for Pipeline as code is very good, so let's just go there: https://pipelinesascode.com/[pipelinesascode.com]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4a34b60

Please sign in to comment.