Skip to content

Commit

Permalink
Improvements to provider building (#1779)
Browse files Browse the repository at this point in the history
This change fixes several oddities in the provider build action, namely
using the version variable for the providers list. It also removes
manual invocation inputs because it currently builds the latest.json
file based on what its built in dist/

---------

Signed-off-by: Ben Rockwood <[email protected]>
  • Loading branch information
benr authored Sep 19, 2023
1 parent fc5c872 commit e46f977
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/providers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@ name: 'Build & Release Providers'

on:
workflow_dispatch:
inputs:
version:
description: "Providers that should be released"
default: "arista aws azure equinix gcp github gitlab google-workspace ipmi k8s ms365 network oci okta opcua os slack terraform vcd vsphere"
# inputs:
# providers:
# description: "Providers to build (Space separated, leave empty for all providers)"
# default: ""
# required: false

env:
BUCKET: releases-us.mondoo.io
PROVIDERS: "os network"
PROVIDERS: 'arista aws azure equinix gcp github gitlab google-workspace ipmi k8s ms365 network oci okta opcua os slack terraform vcd vsphere'

jobs:
build:
runs-on: self-hosted
timeout-minutes: 60
timeout-minutes: 120
steps:
- name: Version from Workflow Dispatch
if: github.event_name == 'workflow_dispatch'
- name: Converge provider list inputs
run: |
echo "PROVIDERS=${{ github.event.inputs.version }}" >> $GITHUB_ENV
if [ -z "${{ github.event.inputs.providers }}" ]; then
echo "No providers specified, building all"
echo "PROVIDERS=${PROVIDERS}" >> $GITHUB_ENV
else
echo "Building ${{ github.event.inputs.providers }}"
echo "PROVIDERS=${{ github.event.inputs.providers }}" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -65,9 +71,12 @@ jobs:
echo "{ \"name\": \"${PROVIDER}\", \"version\": \"${VERSION}\" }" >> "dist/${pkg}.json"
done
- name: 'Publish latest.json'
- name: 'Generate and Publish latest.json'
run: |
echo "{ \"providers\": [$(ls dist/*.json | xargs cat | paste -sd, -)] }" > dist/latest.json
echo "Latest.json contents:"
cat dist/latest.json
echo "---"
gsutil -m cp -c dist/latest.json gs://${BUCKET}/providers/
- name: Trigger Reindex of releases.mondoo.com
Expand Down
10 changes: 6 additions & 4 deletions scripts/provider_bundler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ build_bundle windows amd64
build_bundle windows arm64

# Generate SHA256 checksums
echo "Generating SHA256 checksums..."
echo " - Generating SHA256 checksums..."
cd $BUNDLE_DIST
shasum -a 256 ${PROVIDER_NAME}_${PROVIDER_VERSION}_*.xz > ${PROVIDER_NAME}_${PROVIDER_VERSION}_SHA256SUMS

printf "\n\n"
echo "The ${PROVIDER_NAME} provider has been built and bundled successfully."
echo "The bundles can be found in ${BUNDLE_DIST}."
echo "Time Elapsed: $((($(date +%s)-$START_TIME)/60)) minutes"
echo " The ${PROVIDER_NAME} provider has been built and bundled successfully."
echo " The bundles can be found in ${BUNDLE_DIST}."
echo " Time Elapsed: $((($(date +%s)-$START_TIME)/60)) minutes"
echo "-------------------------------------------------------"
echo ""

0 comments on commit e46f977

Please sign in to comment.