mirror of
https://github.com/bitnami/containers.git
synced 2026-03-27 15:27:48 +08:00
[containers/*] Publish workflow (#19)
* Add publish pipeline Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
69
.github/workflows/cd-scheduled-pipeline.yaml
vendored
Normal file
69
.github/workflows/cd-scheduled-pipeline.yaml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# Temporary workflow to train publish actions. It will be removed in a close future
|
||||
name: Scheduled CD
|
||||
on:
|
||||
schedule:
|
||||
- cron: "?/15 * * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
container:
|
||||
description: Force VIB publication with this container
|
||||
required: false
|
||||
env:
|
||||
CSP_API_URL: https://console.cloud.vmware.com
|
||||
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
|
||||
VIB_PUBLIC_URL: https://cp.bromelia.vmware.com
|
||||
jobs:
|
||||
get-container:
|
||||
runs-on: ubuntu-latest
|
||||
name: Get random container
|
||||
outputs:
|
||||
container: ${{ steps.get-container.outputs.container }}
|
||||
flavors: ${{ steps.get-container.outputs.flavors }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Checkout Repository
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- id: get-container
|
||||
name: Get random container
|
||||
run: |
|
||||
container_name="${{ github.event.inputs.container }}"
|
||||
if [ -z "$container_name" ]; then
|
||||
containers=(containers/*)
|
||||
random_index=$(( $RANDOM % ${#containers[@]} ))
|
||||
container_name=$(echo "${containers[$random_index]}" | sed "s|containers/||g")
|
||||
fi
|
||||
flavors=(containers/${container_name}/*/*/)
|
||||
flavors_json="["
|
||||
for flavor in "${flavors[@]}"; do
|
||||
tag="$(git log --pretty=tformat:"%s" -n 1 --grep=" release$" --author bitnami-bot@vmware.com --author containers@bitnami.com --author containers-bot@bitnami.com -- ${flavor} | awk '{print $1}')"
|
||||
flavors_json+="{\"path\": \"${flavor}\", \"tag\": \"${tag}\"},"
|
||||
done;
|
||||
flavors_json="${flavors_json/%,/]}"
|
||||
|
||||
echo "::set-output name=container::${container_name}"
|
||||
echo "::set-output name=flavors::${flavors_json}"
|
||||
vib-publish:
|
||||
runs-on: ubuntu-latest
|
||||
needs: get-container
|
||||
name: Publish
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: ${{ fromJSON(needs.get-container.outputs.flavors) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Checkout Repository
|
||||
- uses: vmware-labs/vmware-image-builder-action@main
|
||||
name: Publish ${{ needs.get-container.outputs.container }}
|
||||
with:
|
||||
pipeline: vib-publish.json
|
||||
env:
|
||||
# Path with docker resources
|
||||
VIB_ENV_PATH: ${{ matrix.flavor.path }}
|
||||
# Container name
|
||||
VIB_ENV_CONTAINER: ${{ needs.get-container.outputs.container }}
|
||||
VIB_ENV_TAG: ${{ matrix.flavor.tag }}
|
||||
VIB_ENV_REGISTRY_URL: ${{ secrets.OCI_REGISTRY_URL }}
|
||||
VIB_ENV_REGISTRY_USERNAME: ${{ secrets.OCI_REGISTRY_USERNAME }}
|
||||
VIB_ENV_REGISTRY_PASSWORD: ${{ secrets.OCI_REGISTRY_PASSWORD }}
|
||||
Reference in New Issue
Block a user