Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit of MACHINE.

Signed-off-by: Michael Mitchell <[email protected]>
  • Loading branch information
mmitchel committed Dec 29, 2024
0 parents commit a954fb6
Show file tree
Hide file tree
Showing 8 changed files with 1,001 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# default ownership: default owners for everything in the repo (Unless a later match takes precedence)
* @distro-core/developers
165 changes: 165 additions & 0 deletions .github/workflows/dispatch-images-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Dispatch Images Build

# This workflow represents a specific configuration for a
# single MACHINE as a specific design goal. It utilizes a
# reusable workflow found at distro-core/distro-manifest.

# Variables and Actions
# secrets.AWS_ACCESS_KEY_ID Reusable Workflow, S3 Access Key
# secrets.AWS_SECRET_ACCESS_KEY Reusable Workflow, S3 Secret Key
# secrets.AWS_ENDPOINT_URL Reusable Workflow, S3 Endpoint Hostname
# liskin/gh-workflow-keepalive Action, Keepalive

# Self hosted runners have the prerequsite dependency to
# install the host tools dependencies before workflow use.

on:
workflow_dispatch:
inputs:
DISTROS:
required: true
type: choice
default: distro-core
options:
- distro-core
- distro-core-no-gui
TARGETS:
required: true
type: string
default: distro-image

# cancel previous workflow runs to avoid concurrency issues

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# workflow permissions for current repository

permissions:
actions: write
contents: write

# default shell for all jobs

defaults:
run:
shell: bash

########################################################################

jobs:

# runner-name selects a self-hosted runner which has a label that
# matches its name. The setup has to be performed before the
# workflow instance is used; there can only be a single runner
# with the label that matches its name. this allows for
# GITHUB_WORKSPACE to be retained between individual jobs and
# steps.

runner-name:
runs-on: [ self-hosted, linux ]
outputs:
runner-name: ${{ steps.gen-outputs.outputs.runner-name }}
runner-environment: ${{ steps.gen-outputs.outputs.runner-environment }}
steps:
- id: gen-outputs
env:
RUNNER_NAME: ${{ runner.name }}
RUNNER_ENVIRONMENT: ${{ runner.environment }}
run: |
: execute create outputs
echo "runner-name=$RUNNER_NAME" >> $GITHUB_OUTPUT
echo "runner-environment=$RUNNER_ENVIRONMENT" >> $GITHUB_OUTPUT
: generate summary
echo "~~~ text" >> $GITHUB_STEP_SUMMARY
echo "runner-name=$RUNNER_NAME runner-environment=$RUNNER_ENVIRONMENT" >> $GITHUB_STEP_SUMMARY
echo "~~~" >> $GITHUB_STEP_SUMMARY
# keepalive prevents the workflow from being disabled due to
# repository inactivity.

keepalive:
needs: [ runner-name ]
runs-on: ${{ needs.runner-name.outputs.runner-name }}
steps:
- uses: liskin/[email protected]

# contexts reports in the summary log contents of contexts

contexts:
needs: [ runner-name, keepalive ]
uses: distro-core/distro-manifest/.github/workflows/images-contexts.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}

# remove the workspace contents; self-hosted runners retain the
# workspace contents between jobs.

pre-cleanup:
needs: [ runner-name, contexts ]
if: always()
uses: distro-core/distro-manifest/.github/workflows/images-cleanup.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}

# repo init, sync and manifest; the job creates the workspace
# contents and the .repo directory that are referenced in later
# jobs.

repo-init:
needs: [ runner-name, pre-cleanup ]
uses: distro-core/distro-manifest/.github/workflows/images-repo-init-sync.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
MANIFEST_URI: https://github.com/distro-core/distro-manifest.git
MANIFEST_BRANCH: main
MANIFEST_NAME: distro-head-kirkstone.xml

# build steps to create artifacts.

build:
needs: [ runner-name, repo-init ]
uses: distro-core/distro-manifest/.github/workflows/images-build.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
timeout-minutes: 960
DISTRO_CODENAME: kirkstone
DISTROS: ${{ inputs.DISTROS }}
MACHINES: sbc-pine64-star64
TARGETS_CLEAN:
TARGETS_FETCH:
TARGETS_BEFORE:
TARGETS: ${{ inputs.TARGETS }}
TARGET_FLAGS:

# deploy steps to save artifacts.

deploy:
needs: [ runner-name, repo-init, build ]
uses: distro-core/distro-manifest/.github/workflows/images-deploy-buckets.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
timeout-minutes: 360
DISTRO_CODENAME: kirkstone
DISTROS: ${{ inputs.DISTROS }}
MACHINES: sbc-pine64-star64
TARGETS_CLEAN:
TARGETS_FETCH:
TARGETS_BEFORE:
TARGETS: ${{ inputs.TARGETS }}
TARGET_FLAGS:
secrets:
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

# remove the workspace contents; self-hosted runners retain the
# workspace contents between jobs.

post-cleanup:
needs: [ runner-name, deploy ]
if: always()
uses: distro-core/distro-manifest/.github/workflows/images-cleanup.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
165 changes: 165 additions & 0 deletions .github/workflows/dispatch-images-fetch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Dispatch Images Fetch

# This workflow represents a specific configuration for a
# single MACHINE as a specific design goal. It utilizes a
# reusable workflow found at distro-core/distro-manifest.

# Variables and Actions
# secrets.AWS_ACCESS_KEY_ID Reusable Workflow, S3 Access Key
# secrets.AWS_SECRET_ACCESS_KEY Reusable Workflow, S3 Secret Key
# secrets.AWS_ENDPOINT_URL Reusable Workflow, S3 Endpoint Hostname
# liskin/gh-workflow-keepalive Action, Keepalive

# Self hosted runners have the prerequsite dependency to
# install the host tools dependencies before workflow use.

on:
workflow_dispatch:
inputs:
DISTROS:
required: true
type: choice
default: distro-core
options:
- distro-core
- distro-core-no-gui
TARGETS:
required: true
type: string
default: distro-image

# cancel previous workflow runs to avoid concurrency issues

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# workflow permissions for current repository

permissions:
actions: write
contents: write

# default shell for all jobs

defaults:
run:
shell: bash

########################################################################

jobs:

# runner-name selects a self-hosted runner which has a label that
# matches its name. The setup has to be performed before the
# workflow instance is used; there can only be a single runner
# with the label that matches its name. this allows for
# GITHUB_WORKSPACE to be retained between individual jobs and
# steps.

runner-name:
runs-on: [ self-hosted, linux ]
outputs:
runner-name: ${{ steps.gen-outputs.outputs.runner-name }}
runner-environment: ${{ steps.gen-outputs.outputs.runner-environment }}
steps:
- id: gen-outputs
env:
RUNNER_NAME: ${{ runner.name }}
RUNNER_ENVIRONMENT: ${{ runner.environment }}
run: |
: execute create outputs
echo "runner-name=$RUNNER_NAME" >> $GITHUB_OUTPUT
echo "runner-environment=$RUNNER_ENVIRONMENT" >> $GITHUB_OUTPUT
: generate summary
echo "~~~ text" >> $GITHUB_STEP_SUMMARY
echo "runner-name=$RUNNER_NAME runner-environment=$RUNNER_ENVIRONMENT" >> $GITHUB_STEP_SUMMARY
echo "~~~" >> $GITHUB_STEP_SUMMARY
# keepalive prevents the workflow from being disabled due to
# repository inactivity.

keepalive:
needs: [ runner-name ]
runs-on: ${{ needs.runner-name.outputs.runner-name }}
steps:
- uses: liskin/[email protected]

# contexts reports in the summary log contents of contexts

contexts:
needs: [ runner-name, keepalive ]
uses: distro-core/distro-manifest/.github/workflows/images-contexts.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}

# remove the workspace contents; self-hosted runners retain the
# workspace contents between jobs.

pre-cleanup:
needs: [ runner-name, contexts ]
if: always()
uses: distro-core/distro-manifest/.github/workflows/images-cleanup.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}

# repo init, sync and manifest; the job creates the workspace
# contents and the .repo directory that are referenced in later
# jobs.

repo-init:
needs: [ runner-name, pre-cleanup ]
uses: distro-core/distro-manifest/.github/workflows/images-repo-init-sync.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
MANIFEST_URI: https://github.com/distro-core/distro-manifest.git
MANIFEST_BRANCH: main
MANIFEST_NAME: distro-head-kirkstone.xml

# build steps to create artifacts.

build:
needs: [ runner-name, repo-init ]
uses: distro-core/distro-manifest/.github/workflows/images-build.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
timeout-minutes: 960
DISTRO_CODENAME: kirkstone
DISTROS: ${{ inputs.DISTROS }}
MACHINES: sbc-pine64-star64
TARGETS_CLEAN:
TARGETS_FETCH:
TARGETS_BEFORE:
TARGETS: ${{ inputs.TARGETS }}
TARGET_FLAGS: --runall=fetch

# deploy steps to save artifacts.

deploy:
needs: [ runner-name, repo-init, build ]
uses: distro-core/distro-manifest/.github/workflows/images-deploy-buckets.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
timeout-minutes: 360
DISTRO_CODENAME: kirkstone
DISTROS: ${{ inputs.DISTROS }}
MACHINES: sbc-pine64-star64
TARGETS_CLEAN:
TARGETS_FETCH:
TARGETS_BEFORE:
TARGETS: ${{ inputs.TARGETS }}
TARGET_FLAGS: --runall=fetch
secrets:
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

# remove the workspace contents; self-hosted runners retain the
# workspace contents between jobs.

post-cleanup:
needs: [ runner-name, deploy ]
if: always()
uses: distro-core/distro-manifest/.github/workflows/images-cleanup.yml@main
with:
runner-name: ${{ needs.runner-name.outputs.runner-name }}
Loading

0 comments on commit a954fb6

Please sign in to comment.