Skip to content

Commit

Permalink
Updates to have proper versioned workshops
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoralespou committed Jun 18, 2024
1 parent b2f06b7 commit d0f5528
Show file tree
Hide file tree
Showing 51 changed files with 776 additions and 7 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/publish-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Publish Workshops

on:
push:
tags:
- "[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+-alpha.[0-9]+"
- "[0-9]+.[0-9]+-beta.[0-9]+"
- "[0-9]+.[0-9]+-rc.[0-9]+"
branches:
- main
- develop
workflow_dispatch:

jobs:
publish-workshops:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Carvel tools
shell: bash
run: curl -L https://carvel.dev/install.sh | bash

- name: Install Educates CLI
shell: bash
run: |
# curl -Lo /usr/local/bin/educates https://github.com/vmware-tanzu-labs/educates-training-platform/releases/download/2.7.2/educates-linux-amd64
# chmod +x /usr/local/bin/educates
imgpkg pull -i ghcr.io/vmware-tanzu-labs/educates-client-programs:2.7.2 -o /tmp/client-programs
mv /tmp/client-programs/educates-linux-amd64 /usr/local/bin/educates
- name: Setup repository variables and release details
shell: bash
run: |
REPOSITORY_NAME=${{github.event.repository.name}}
echo "REPOSITORY_NAME=${REPOSITORY_NAME,,}" >>${GITHUB_ENV}
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
echo "REPOSITORY_TAG=${GITHUB_REF##*/}" >>${GITHUB_ENV}
- name: Publish workshops and create workshop definitions for bundle-colours
shell: bash
run: |
for WORKSHOP_DIRECTORY in workshops/bundle-colours/*; do
mkdir -p ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources
educates publish-workshop ${WORKSHOP_DIRECTORY} \
--export-workshop ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/workshop.yaml \
--image-repository=ghcr.io/${REPOSITORY_OWNER} \
--workshop-version=${REPOSITORY_TAG} \
--registry-username=${{github.actor}} \
--registry-password=${{secrets.GITHUB_TOKEN}}
done
- name: Publish workshops and create workshop definitions for bundle-animals
shell: bash
run: |
for WORKSHOP_DIRECTORY in workshops/bundle-animals/*; do
mkdir -p ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/
educates publish-workshop ${WORKSHOP_DIRECTORY} \
--export-workshop ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/workshop.yaml \
--image-repository=ghcr.io/${REPOSITORY_OWNER} \
--workshop-version=${REPOSITORY_TAG} \
--registry-username=${{github.actor}} \
--registry-password=${{secrets.GITHUB_TOKEN}}
done
- name: Generate archives containing the workshop definitions
shell: bash
run: |
ytt -f ${{runner.temp}}/workshops > ${{runner.temp}}/workshops-all.yaml
(cd ${{runner.temp}}; tar cvfz workshops-all.tar.gz workshops)
(cd ${{runner.temp}}; zip workshops-all.zip -r workshops)
ytt -f ${{runner.temp}}/workshops/bundle-colours > ${{runner.temp}}/workshops-colours.yaml
(cd ${{runner.temp}}; tar cvfz workshops-colours.tar.gz workshops/bundle-colours)
(cd ${{runner.temp}}; zip workshops-colours.zip -r workshops/bundle-colours)
ytt -f ${{runner.temp}}/workshops/bundle-animals > ${{runner.temp}}/workshops-animals.yaml
(cd ${{runner.temp}}; tar cvfz workshops-animals.tar.gz workshops/bundle-animals)
(cd ${{runner.temp}}; zip workshops-animals.zip -r workshops/bundle-animals)
- name: Create the GitHub release for the workshops
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{env.REPOSITORY_TAG}}
name: ${{env.REPOSITORY_NAME}}:${{env.REPOSITORY_TAG}}
draft: false
prerelease: false
files: |
${{runner.temp}}/workshops.tar.gz
${{runner.temp}}/workshops.zip
${{runner.temp}}/workshops-all.yaml
${{runner.temp}}/workshops-colours.yaml
${{runner.temp}}/workshops-animals.yaml
resources/trainingportal.yaml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ This will produce a list of workshops, a trainingportal based on config and kbld
ytt -v name=workshop-bundle-colours \
-v mode=app_per_bundle \
--data-values-file test/portal-app/config \
-f test/portal-app/workshops/workshop-bundle-colours \
-f workshops/bundle-colours/ \
-f overlays/portal-app/src/bundle/config/ytt \
-f overlays/portal-app/src/bundle/config/kapp

ytt -v name=workshop-bundle-animals \
-v mode=app_per_bundle \
--data-values-file test/portal-app/config \
-f test/portal-app/workshops/workshop-bundle-animals \
-f workshops/bundle-animals/ \
-f overlays/portal-app/src/bundle/config/ytt \
-f overlays/portal-app/src/bundle/config/kapp
```
Expand All @@ -197,7 +197,7 @@ ytt -v name=workshop-bundle-animals \
ytt -v name=global \
-v mode=one_app \
--data-values-file test/portal-app/config \
-f test/portal-app/workshops/workshop-bundle-animals \
-f workshops/workshops/ \
-f overlays/portal-app/src/bundle/config/ytt \
-f overlays/portal-app/src/bundle/config/kapp
```
Expand Down
13 changes: 9 additions & 4 deletions test-local/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ educates admin cluster create --config kind-config.yaml
imgpkg --debug push -i localhost:5001/gitops-configurer:devel -f ../overlays
```
2. Create your version of the configuration files in the [versions](./secret-versions.yaml), [common](./secret-common.yaml) and
2. Create the required [RBAC](./rbac.yaml).
```
kubectl apply -f rbac.yaml
```
3. Create your version of the configuration files in the [versions](./secret-versions.yaml), [common](./secret-common.yaml) and
[workshops](./secret-workshops.yaml) secrets and deploy them into the cluster:
```
Expand All @@ -21,14 +27,13 @@ educates admin cluster create --config kind-config.yaml
kubectl apply -f secret-workshops.yaml
```
3. Create the required [RBAC](./rbac.yaml) and [Gitops App definition](./crd-devel.yaml) and deploy it into your cluster.
4. Create the required [Gitops App definition](./crd-devel.yaml) and deploy it into your cluster.
```
kubectl apply -f rbac.yaml
kubectl apply -f crd-devel.yaml
```
4. If you want to test any change in configuration, modify the appropriate secret and apply it into the cluster and wait for a reconciliation.
5. If you want to test any change in configuration, modify the appropriate secret and apply it into the cluster and wait for a reconciliation.
If you don't want to wait, kick the reconciliation manually of the main gitops app:
```
Expand Down
3 changes: 3 additions & 0 deletions workshops/bundle-animals/workshop-bird/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workshop

Workshop description
34 changes: 34 additions & 0 deletions workshops/bundle-animals/workshop-bird/resources/workshop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: training.educates.dev/v1beta1
kind: Workshop
metadata:
name: "workshop-bird"
spec:
title: "Workshop"
description: "Workshop description."
publish:
image: "$(image_repository)/workshop-bird-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/workshop-bird-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
- /README.md
session:
namespaces:
budget: medium
applications:
terminal:
enabled: true
layout: split
editor:
enabled: true
console:
enabled: false
docker:
enabled: false
registry:
enabled: false
vcluster:
enabled: false
31 changes: 31 additions & 0 deletions workshops/bundle-animals/workshop-bird/workshop/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# pathways:
# default: workshop
#
# paths:
# workshop:
# title: "Workshop"
#
# steps:
# - 00-workshop-overview
# - 01-workshop-instructions
# - 99-workshop-summary
#
# params:
# - name: NAME
# value: undefined
# aliases:
# - ALIAS

# modules:
# - name: 00-workshop-overview
# title: Workshop Overview
# - name: 01-workshop-instructions
# title: Workshop Instructions
# - name: 99-workshop-summary
# title: Workshop Summary

# params:
# - name: NAME
# value: undefined
# aliases:
# - ALIAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Overview
---

This is the initial landing page for your workshop. Include in this page a description of what your workshop is about.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Instructions
---

This is the first page of the workshop instructions, create as many separate pages as you need to. If necessary pages can be located in sub directories to provided grouping.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Summary
---

This is the last page of the workshop. Include in this page a summary of the workshop and any links to resources relevant to the workshop. This ensures anyone doing the workshop has material they can research later to learn more.
3 changes: 3 additions & 0 deletions workshops/bundle-animals/workshop-cat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workshop

Workshop description
34 changes: 34 additions & 0 deletions workshops/bundle-animals/workshop-cat/resources/workshop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: training.educates.dev/v1beta1
kind: Workshop
metadata:
name: "workshop-cat"
spec:
title: "Workshop"
description: "Workshop description."
publish:
image: "$(image_repository)/workshop-cat-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/workshop-cat-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
- /README.md
session:
namespaces:
budget: medium
applications:
terminal:
enabled: true
layout: split
editor:
enabled: true
console:
enabled: false
docker:
enabled: false
registry:
enabled: false
vcluster:
enabled: false
31 changes: 31 additions & 0 deletions workshops/bundle-animals/workshop-cat/workshop/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# pathways:
# default: workshop
#
# paths:
# workshop:
# title: "Workshop"
#
# steps:
# - 00-workshop-overview
# - 01-workshop-instructions
# - 99-workshop-summary
#
# params:
# - name: NAME
# value: undefined
# aliases:
# - ALIAS

# modules:
# - name: 00-workshop-overview
# title: Workshop Overview
# - name: 01-workshop-instructions
# title: Workshop Instructions
# - name: 99-workshop-summary
# title: Workshop Summary

# params:
# - name: NAME
# value: undefined
# aliases:
# - ALIAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Overview
---

This is the initial landing page for your workshop. Include in this page a description of what your workshop is about.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Instructions
---

This is the first page of the workshop instructions, create as many separate pages as you need to. If necessary pages can be located in sub directories to provided grouping.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Summary
---

This is the last page of the workshop. Include in this page a summary of the workshop and any links to resources relevant to the workshop. This ensures anyone doing the workshop has material they can research later to learn more.
3 changes: 3 additions & 0 deletions workshops/bundle-animals/workshop-dog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workshop

Workshop description
34 changes: 34 additions & 0 deletions workshops/bundle-animals/workshop-dog/resources/workshop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: training.educates.dev/v1beta1
kind: Workshop
metadata:
name: "workshop-dog"
spec:
title: "Workshop"
description: "Workshop description."
publish:
image: "$(image_repository)/workshop-dog-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/workshop-dog-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
- /README.md
session:
namespaces:
budget: medium
applications:
terminal:
enabled: true
layout: split
editor:
enabled: true
console:
enabled: false
docker:
enabled: false
registry:
enabled: false
vcluster:
enabled: false
Loading

0 comments on commit d0f5528

Please sign in to comment.