Skip to content

Commit

Permalink
✨ Add executor plugin configmap to release
Browse files Browse the repository at this point in the history
  • Loading branch information
Shark committed Aug 12, 2022
1 parent c982669 commit 05ceae0
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ jobs:
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Store the image an artifact
uses: actions/upload-artifact@v2.3.1
- name: Store the image as an artifact
uses: actions/upload-artifact@v3
with:
name: container-image
path: /tmp/container-image.tar.bz2
retention-days: 7
if-no-files-found: error
36 changes: 36 additions & 0 deletions .github/workflows/create-executor-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Builds the executor plugin
on:
workflow_call:
inputs:
container_image:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: azure/setup-kubectl@v3

- name: Install Argo Workflows CLI
run: |
curl -sSL https://github.com/argoproj/argo-workflows/releases/download/v3.3.9/argo-linux-amd64.gz | gunzip > /usr/local/bin/argo-linux-amd64
mv /usr/local/bin/argo-linux-amd64 /usr/local/bin/argo
chmod +x /usr/local/bin/argo
- uses: actions/checkout@v2

- name: Build Argo Executor Plugin
run: |
cd argo-plugin
echo '[{"op": "replace", "path": "/spec/sidecar/container/image", "value": "${{ inputs.container_image }}"}]' > image.json
kubectl kustomize . > plugin_with_image.yaml
mv plugin_with_image.yaml plugin.yaml
argo executor-plugin build .
- name: Store the YAML as an artifact
uses: actions/upload-artifact@v3
with:
name: argo-executor-plugin
path: argo-plugin/wasm-executor-plugin-configmap.yaml
retention-days: 7
if-no-files-found: error
9 changes: 9 additions & 0 deletions .github/workflows/publish-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ on:
version:
required: true
type: string
outputs:
container_image:
description: the location of the container image, e.g., ghcr.io/shark/wasm-workflows-plugin:v123
value: ${{ jobs.build.outputs.container_image }}
env:
REGISTRY: ghcr.io
IMAGE_NAME: shark/wasm-workflows-plugin
jobs:
build:
runs-on: ubuntu-latest
outputs:
container_image: ${{ steps.push.outputs.container_image }}
steps:
- name: Download container image artifact
uses: actions/download-artifact@v3
Expand All @@ -29,8 +35,11 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Docker image
id: push
run: |
docker tag sh4rk/wasm-workflows-plugin:${{ inputs.version }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.version }}
docker tag sh4rk/wasm-workflows-plugin:${{ inputs.version }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.version }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
echo "::set-output name=container_image::${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.version }}"
49 changes: 41 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,56 @@ jobs:
version: ${{ needs.build.outputs.version }}
changelog:
uses: ./.github/workflows/create-changelog.yml
executor_plugin:
uses: ./.github/workflows/create-executor-plugin.yml
needs: [publish]
with:
container_image: ${{ needs.publish.outputs.container_image }}
release:
runs-on: ubuntu-latest
needs: [publish, changelog]
needs: [publish, changelog, executor_plugin]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: repo
fetch-depth: 0

- name: Download executor plugin artifact
uses: actions/download-artifact@v3
with:
name: argo-executor-plugin
path: argo-executor-plugin

- name: Create release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.changelog.outputs.tag }}
release_name: Release ${{ needs.changelog.outputs.tag }}
draft: false
prerelease: true
body: ${{ needs.changelog.outputs.changelog }}
name: Release ${{ needs.changelog.outputs.tag }}
tag_name: ${{ needs.changelog.outputs.tag }}
body: |
# Usage
Installing the plugin is simple.
Ensure that you enabled executor plugins [as described in Argo Workflows' documentation](https://argoproj.github.io/argo-workflows/executor_plugins/).
Copy the URL to the ConfigMap YAML in this release and apply it with `kubectl`:
```
kubectl apply -f https://.../wasm-executor-plugin-configmap.yaml
```
That's all you need to submit a workflow with a Wasm module. Use our example:
```
kubectl create -f https://raw.githubusercontent.com/Shark/wasm-workflows-plugin/67ae607ec65e1ac93bc1749c5f7a9bde4b673cfd/wasm-modules/examples/ferris-says/workflow.yaml
```
That's it. :sparkles:
# Changelog
${{ needs.changelog.outputs.changelog }}
files: argo-executor-plugin/wasm-executor-plugin-configmap.yaml
1 change: 1 addition & 0 deletions argo-plugin/image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"op": "replace", "path": "/spec/sidecar/container/image", "value": ""}]
13 changes: 13 additions & 0 deletions argo-plugin/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- plugin.yaml

patchesJson6902:
- target:
group: argoproj.io
version: v1alpha1
kind: ExecutorPlugin
name: wasm
path: image.json

0 comments on commit 05ceae0

Please sign in to comment.