Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions task/asciidoctor/0.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Asciidoctor

Tekton Task for Asciidoctor https://asciidoctor.org

Asciidoctor is a fast, open source, Ruby-based text processor for parsing AsciiDoc into a document model and converting it to output formats such as HTML 5, DocBook 5, manual pages, PDF, EPUB 3, and other formats.

The resulting document can be sent by email, uploaded to the artifact repository, etc. through other tasks.

## Install the Task
```
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/asciidoctor/0.2/asciidoctor.yaml
```

## Pre-requisite
Install git-clone task from catalog
```
https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.3/git-clone.yaml
```

## Workspaces
* **source** : A Workspace containing your source directory.

## Parameters
* **ASCIIDOC_CMD**: Default ```asciidoctor-pdf```. Command to convert AsciiDoc files :
* **asciidoctor**: Basic CLI [Info](https://docs.asciidoctor.org/asciidoctor/latest/cli/)
* **asciidoctor-pdf**: Converter from AsciiDoc to PDF [Info](https://asciidoctor.org/docs/asciidoctor-pdf/)
* **asciidoctor-epub3**: Converter from AsciiDoc to EPUB3 and KF8/MOBI [Info](https://docs.asciidoctor.org/epub3-converter/latest/)
* **asciidoctor-confluence**: Parse asciidoc files them using Asciidoctor and push the result into Confluence [Info](https://github.com/asciidoctor/asciidoctor-confluence)
* **asciidoctor-fb2**: Converter documents directly to the FB2 e-book format [Info](https://github.com/asciidoctor/asciidoctor-fb2)
* **asciidoctor-pdf-optimize**: By default, Asciidoctor PDF does not optimize the PDF it generates or compress its streams. [Info](https://github.com/asciidoctor/asciidoctor-pdf#optimizing-the-generated-pdf)
* **asciidoctor-revealjs**: Converter for Asciidoctor and Asciidoctor.js that transforms an AsciiDoc document into an HTML5 presentation designed to be executed by the reveal.js presentation framework. [Info](https://docs.asciidoctor.org/reveal.js-converter/latest/)
* **ADOC_PATH** : The .adoc file path. Default ```./Readme.md```.
* **ASCIIDOC_ARGS**: The Arguments to be passed to Asciidoctor command, for example ```-a lang=es -a draft=yes```. Each binary can have different arguments, see the information of each binary of **ASCIIDOC_CMD**.
* **ASCIIDOC_IMAGE**: Asciidoctor image to be used. default ```docker.io/asciidoctor/docker-asciidoctor:1.16```.

## Platforms

The Task can be run on `linux/amd64` platform.

## Usage

In the [tests](../0.1/tests/run.yaml), folder there is an example of the execution of the task, a [PVC](../0.1/tests/pvc.yaml) is used.

## Sample asciidoc code and output

The complete code for the example is in the [repository](https://github.com/jandradap/tekton-asciidoctor-demo).

**Asciidoc code:**
```md
== Title 2

Crystalline XML tags relentlessly bombarded the theater.

.XML tags
[source,xml]
----
<author id="1">
<personname>
<firstname>Lazarus</firstname>
<surname>het Draeke</surname>
</personname>
</author>
----

Despite the assault, we continued our pursuit to draft a DefOps{empty}footnote:defops[] plan.

.DefOps Plan
====
Click btn:[Download Zip] to download the defensive operation plan bundle.

OMG!
Somebody please save us now!
I want my mum -- and an extra-large double macchiato, please.
====

Unfortunaly, Lazarus and I had both come to the conclusion that we weren't going to get out of
this without corrupted hardrives if we didn't locate caffeine within the next few hours.

=== Subitle 2

This potion for a sample document contains the following ingredients, which are listed in a
very random, chaotically nested order.

.Ingredients for Potion that Demystifies Documents
* all the headings
** syntax highlighted source code
*** non-syntax highlighted source code or just a listing block
* quote block
** verse block
*** table with some cell formatting
**** sequential paragraphs
***** admonition blocks, but use them sparingly
*** bullet list with nesting
** numbered list with nesting
** definition list
*** sidebar
```

**Output:**

![Title page](https://raw.githubusercontent.com/jandradap/tekton-asciidoctor-demo/main/images/pag1.png)
![Random page](https://raw.githubusercontent.com/jandradap/tekton-asciidoctor-demo/main/images/pag3.png)
53 changes: 53 additions & 0 deletions task/asciidoctor/0.2/asciidoctor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
annotations:
tekton.dev/pipelines.minVersion: "0.50.0"
tekton.dev/categories: Publishing
tekton.dev/tags: 'asciidoctor, Publishing, PDF, EPUB'
tekton.dev/displayName: "asciidoctor text processor"
tekton.dev/platforms: "linux/amd64"
name: asciidoctor
labels:
app.kubernetes.io/version: "0.2"
spec:
description: >-
Asciidoctor is a fast, open source, Ruby-based text processor
for parsing AsciiDoc into a document model and converting it
to output formats such as HTML 5, DocBook 5, manual pages, PDF,
EPUB 3, and other formats.
params:
- name: ASCIIDOC_CMD
description: Command to convert AsciiDoc files asciidoctor, asciidoctor-pdf, asciidoctor-epub3
type: string
default: 'asciidoctor-pdf'
- name: ADOC_PATH
description: The .adoc file path.
type: string
default: './Readme.adoc'
- name: ASCIIDOC_ARGS
description: The Arguments to be passed to Asciidoctor command.
type: string
- name: ASCIIDOC_IMAGE
default: docker.io/asciidoctor/docker-asciidoctor:1.16@sha256:36117d900e9365923dcf1d79c99eb82192c3d1b81ca1bb077e3373f722532e05
description: Asciidoctor image to be used
steps:
- name: asciidoctor
image: $(params.ASCIIDOC_IMAGE)
workingDir: $(workspaces.source.path)
script: |
#!/usr/bin/env sh
set -e
ls -lh
"${ASCIIDOC_CMD}" "${ASCIIDOC_ARGS}" "${ADOC_PATH}"
env:
- name: ASCIIDOC_CMD
value: "$(params.ASCIIDOC_CMD)"
- name: ADOC_PATH
value: "$(params.ADOC_PATH)"
- name: ASCIIDOC_ARGS
value: "$(params.ASCIIDOC_ARGS)"
workspaces:
- description: A workspace that contains fetched git repo.
name: source
4 changes: 4 additions & 0 deletions task/asciidoctor/0.2/tests/pre-apply-task-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Add git-clone
add_task git-clone latest
10 changes: 10 additions & 0 deletions task/asciidoctor/0.2/tests/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: asciidoctor-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
72 changes: 72 additions & 0 deletions task/asciidoctor/0.2/tests/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: asciidoctor-pipeline
spec:
params:
- name: repository
type: string
- name: ASCIIDOC_CMD
type: string
- name: ADOC_PATH
type: string
- name: ASCIIDOC_ARGS
type: string
- name: ASCIIDOC_IMAGE
type: string
workspaces:
- name: source
tasks:
- name: clone-git-repo
workspaces:
- name: output
workspace: source
taskRef:
name: git-clone
params:
- name: url
value: $(params.repository)
- name: deleteExisting
value: "true"
- name: asciidoctor
taskRef:
kind: Task
name: asciidoctor
runAfter:
- clone-git-repo
workspaces:
- name: source
workspace: source
params:
- name: ASCIIDOC_CMD
value: $(params.ASCIIDOC_CMD)
- name: ADOC_PATH
value: $(params.ADOC_PATH)
- name: ASCIIDOC_ARGS
value: $(params.ASCIIDOC_ARGS)
- name: ASCIIDOC_IMAGE
value: $(params.ASCIIDOC_IMAGE)
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: asciidoctor-pipelinerun
spec:
pipelineRef:
name: asciidoctor-pipeline
params:
- name: repository
value: https://github.com/jandradap/tekton-asciidoctor-demo.git
- name: ASCIIDOC_CMD
value: 'asciidoctor-pdf'
- name: ADOC_PATH
value: './Readme.adoc'
- name: ASCIIDOC_ARGS
value: '-a lang=es'
- name: ASCIIDOC_IMAGE
value: docker.io/asciidoctor/docker-asciidoctor:1.16@sha256:36117d900e9365923dcf1d79c99eb82192c3d1b81ca1bb077e3373f722532e05
workspaces:
- name: source
persistentVolumeClaim:
claimName: asciidoctor-pvc
35 changes: 35 additions & 0 deletions task/cloudevent/0.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# CloudEvent Task

Task to send a single CloudEvent to a specified sink.

## Parameters

* **sink**: Sink is the uri to send the event to

* **eventID**: Event ID to send

* **eventType**: The event type to send

_default_: "tekton.cloudevent.message"

* **source**: Source to be set in the Cloudevent metadata.

_default_: "cloudevent-catalog-task"

* **data**: Data payload to deliver

_default_: ""`

## Development

The `ko` tool is required to update the task.yaml - see these [installation instructions](https://github.com/google/ko#installation).

Once you have ko, you can build the binary and resolve the task yaml into installable yaml.

`ko resolve -f config/task.yaml > cloudevent.yaml`

The go import path will be replaced in the yaml by the built container.

## Platforms

The Task can be run on `linux/amd64` platform.
43 changes: 43 additions & 0 deletions task/cloudevent/0.2/cloudevent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: cloudevent
labels:
app.kubernetes.io/version: "0.2"
annotations:
tekton.dev/pipelines.minVersion: "0.50.0"
tekton.dev/categories: Networking
tekton.dev/tags: cloud
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
This Task send a single CloudEvent to a specified sink.
params:
- name: sink
type: string
description: Sink to send Event to
- name: eventID
type: string
description: Event ID to use
- name: eventType
type: string
description: The Event Type to use
default: "tekton.cloudevent.message"
- name: source
type: string
description: Source of the CloudEvent
default: ""
- name: data
type: string
description: The payload of the Event
default: ""
steps:
- name: send
image: docker.io/iancoffey/sendevent-89c3de01c503ceb66b676a3e41c265ed@sha256:fc39998cba7ad8e54323b948b56b11b0b235996069349fb74776865fedf182a5
command: ["sendevent"]
args:
- "--event-id=$(params.eventID)"
- "--event-type=$(params.eventType)"
- "--source=$(params.source)"
- "--data=$(params.data)"
- "$(params.sink)"
42 changes: 42 additions & 0 deletions task/cloudevent/0.2/config/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: cloudevent
labels:
app.kubernetes.io/version: "0.2"
annotations:
tekton.dev/pipelines.minVersion: "0.50.0"
tekton.dev/tags: cloud
spec:
description: >-
This Task send a single CloudEvent to a specified sink.
params:
- name: sink
type: string
description: Sink to send Event to
- name: eventID
type: string
description: Event ID to use
- name: eventType
type: string
description: The Event Type to use
default: "tekton.cloudevent.message"
- name: source
type: string
description: Source of the CloudEvent
default: ""
- name: data
type: string
description: The payload of the Event
default: ""
steps:
- name: send
image: github.com/knative/eventing/cmd/sendevent
command: ["sendevent"]
args:
- "--event-id=$(params.eventID)"
- "--event-type=$(params.eventType)"
- "--source=$(params.source)"
- "--data=$(params.data)"
- "$(params.sink)"
Loading
Loading