-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jose R. Gonzalez <[email protected]>
- Loading branch information
Showing
72 changed files
with
6,664 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main", "gh-pages" ] | ||
release: | ||
types: [published] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
# Runs a single command using the runners shell | ||
- name: Run a one-line script | ||
run: echo Hello, world! | ||
|
||
# Runs a set of commands using the runners shell | ||
- name: Run a multi-line script | ||
run: | | ||
echo Add other actions to build, | ||
echo test, and deploy your project. | ||
- name: Display the dispatching event | ||
env: | ||
e: ${{ toJson(github.event) }} | ||
run: echo "Event Date - $e" | ||
ensure-valid-submitter: | ||
uses: ./.github/workflows/check-chart-locks.yml | ||
with: | ||
# Real-world use case would introspect this data and then pass it to this workflow. | ||
category: community | ||
organization: examplecom | ||
chartname: wildfly | ||
# # This is a basic workflow to help you get started with Actions | ||
|
||
# name: CI | ||
|
||
# # Controls when the workflow will run | ||
# on: | ||
# # Triggers the workflow on push or pull request events but only for the "main" branch | ||
# push: | ||
# branches: [ "main" ] | ||
# pull_request: | ||
# branches: [ "main", "gh-pages" ] | ||
# release: | ||
# types: [published] | ||
|
||
# # Allows you to run this workflow manually from the Actions tab | ||
# workflow_dispatch: | ||
|
||
# # A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
# jobs: | ||
# # This workflow contains a single job called "build" | ||
# build: | ||
# # The type of runner that the job will run on | ||
# runs-on: ubuntu-latest | ||
|
||
# # Steps represent a sequence of tasks that will be executed as part of the job | ||
# steps: | ||
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
# - uses: actions/checkout@v3 | ||
|
||
# # Runs a single command using the runners shell | ||
# - name: Run a one-line script | ||
# run: echo Hello, world! | ||
|
||
# # Runs a set of commands using the runners shell | ||
# - name: Run a multi-line script | ||
# run: | | ||
# echo Add other actions to build, | ||
# echo test, and deploy your project. | ||
|
||
# - name: Display the dispatching event | ||
# env: | ||
# e: ${{ toJson(github.event) }} | ||
# run: echo "Event Date - $e" | ||
# ensure-valid-submitter: | ||
# uses: ./.github/workflows/check-chart-locks.yml | ||
# with: | ||
# # Real-world use case would introspect this data and then pass it to this workflow. | ||
# category: community | ||
# organization: examplecom | ||
# chartname: wildfly | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
# Check Chart Locks review the existing chart locks and fails if | ||
# the submission does not existing in the right directory structure. | ||
name: Ensure Submitter is Valid | ||
# # Check Chart Locks review the existing chart locks and fails if | ||
# # the submission does not existing in the right directory structure. | ||
# name: Ensure Submitter is Valid | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
category: | ||
required: true | ||
type: string | ||
description: The category of the submission. (e.g. "partner", choose from [redhat, partner, community]) | ||
organization: | ||
required: true | ||
type: string | ||
description: The submitting organization (e.g. "hashicorp") | ||
chartname: | ||
required: true | ||
type: string | ||
description: The name of the chart (e.g. "vault") | ||
# on: | ||
# workflow_call: | ||
# inputs: | ||
# category: | ||
# required: true | ||
# type: string | ||
# description: The category of the submission. (e.g. "partners", choose from [redhat, partners, community]) | ||
# organization: | ||
# required: true | ||
# type: string | ||
# description: The submitting organization (e.g. "hashicorp") | ||
# chartname: | ||
# required: true | ||
# type: string | ||
# description: The name of the chart (e.g. "vault") | ||
|
||
env: | ||
LOCKFILE_URL: https://komish.github.io/actions-workflow-call-test/lock.json | ||
# env: | ||
# LOCKFILE_URL: https://komish.github.io/actions-workflow-call-test/lock.json | ||
|
||
jobs: | ||
assert-chart-not-locked-or-locked-but-valid: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Assemble directory path | ||
id: assemble-path | ||
run: | | ||
set -o pipefail | ||
echo "dirpath=${{ inputs.category }}/${{ inputs.organization }}/${{ inputs.chartname }}" | tee -a $GITHUB_OUTPUT | ||
- name: Read entry from current Lockfile | ||
run: | | ||
wget "${{ env.LOCKFILE_URL }}" -O lock.json | ||
md5sum lock.json | ||
- name: Compare lockpaths | ||
run: | | ||
lockpath=$(jq -r .packages.${{ inputs.chartname }} lock.json) | ||
test "${lockpath}" == "null" \ | ||
&& { echo "No lock found for chart ${{ inputs.chartname }}. We're clear to merge this in."; exit 0 ;} | ||
test "${lockpath}" = "${{ steps.assemble-path.outputs.dirpath }}" \ | ||
&& { echo "Lock found for chart ${{ inputs.chartname }} and submission is coming from the correct path ${{ steps.assemble-path.outputs.dirpath }}."; exit 0 ;} | ||
# jobs: | ||
# assert-chart-not-locked-or-locked-but-valid: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Assemble directory path | ||
# id: assemble-path | ||
# run: | | ||
# set -o pipefail | ||
# echo "dirpath=${{ inputs.category }}/${{ inputs.organization }}/${{ inputs.chartname }}" | tee -a $GITHUB_OUTPUT | ||
# - name: Read entry from current Lockfile | ||
# run: | | ||
# wget "${{ env.LOCKFILE_URL }}" -O lock.json | ||
# md5sum lock.json | ||
# - name: Compare lockpaths | ||
# run: | | ||
# lockpath=$(jq -r .packages.${{ inputs.chartname }} lock.json) | ||
# test "${lockpath}" == "null" \ | ||
# && { echo "No lock found for chart ${{ inputs.chartname }}. We're clear to merge this in."; exit 0 ;} | ||
# test "${lockpath}" = "${{ steps.assemble-path.outputs.dirpath }}" \ | ||
# && { echo "Lock found for chart ${{ inputs.chartname }} and submission is coming from the correct path ${{ steps.assemble-path.outputs.dirpath }}."; exit 0 ;} | ||
|
||
echo "::error::Submission is invalid. The chart name '${{ inputs.chartname }}' is locked to submissions from path '${lockpath}' and this submission appears to come from '${{ steps.assemble-path.outputs.dirpath }}'" | ||
exit 1 | ||
# echo "::error::Submission is invalid. The chart name '${{ inputs.chartname }}' is locked to submissions from path '${lockpath}' and this submission appears to come from '${{ steps.assemble-path.outputs.dirpath }}'" | ||
# exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Check Contributor | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
user: | ||
type: string | ||
required: true | ||
fail-workflow: | ||
type: boolean | ||
required: false | ||
default: false | ||
description: fails this workflow if the contributor evaluation returns a non-zero exit code | ||
jobs: | ||
check-content: | ||
outputs: | ||
is-repo-owner: steps.populate-output.outputs.is-repo-owner | ||
name: Contributor is repo owner | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout repository base | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install CI Scripts | ||
run: | | ||
# set up python scripts | ||
echo "set up python script in $PWD" | ||
python3 -m venv ve1 | ||
cd scripts | ||
../ve1/bin/pip3 install -r requirements.txt | ||
../ve1/bin/pip3 install . | ||
cd .. | ||
- name: Check contributor | ||
id: check-contributor | ||
continue-on-error: true | ||
run: | | ||
./ve1/bin/user-is-repo-owner ${{ inputs.user }} | ||
- name: Add result to output | ||
id: populate-output | ||
# Outcome is the result of the workflow before continue-on-error is applied | ||
run: | | ||
echo "is-repo-owner=${{ steps.check-contributor.outcome == 'success' }}" >> $GITHUB_OUTPUT | ||
- name: Fail if requested | ||
if: inputs.fail-workflow && steps.populate-output.is-repo-owner != 'success' | ||
run: | | ||
exit -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Test Check Content | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, synchronize, reopened, edited, ready_for_review, labeled] | ||
|
||
jobs: | ||
check-content: | ||
name: Check Content | ||
uses: ./.github/workflows/check-contributor.yml | ||
if: | | ||
github.event.pull_request.draft == false | ||
with: | ||
user: ${{ github.event.pull_request.user.login }} | ||
fail-workflow: true | ||
|
||
run-after: | ||
name: Runs After | ||
needs: check-content | ||
runs-on: ubuntu-20.04 | ||
if: | | ||
github.event.pull_request.draft == false | ||
steps: | ||
- run: | | ||
echo '${{ toJson(needs.check-content) }}' | ||
echo "Woo hoo!" |
Oops, something went wrong.