Skip to content

Commit

Permalink
Add pipeline code
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianliebig committed Oct 17, 2024
1 parent 2516c1f commit aad5fa1
Show file tree
Hide file tree
Showing 4 changed files with 4,352 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflow_templates/runner_attach_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Attaches a runner to your repository

on:
workflow_call:
inputs:
RunnerCount:
description: 'Number of runners to attach'
required: false
default: 1
type: number
RunnerComputeType:
description: 'The type which indicates the compute power of the runner. Either "XS", "S", "M", "L" or "XL"'
required: false
default: 'S'
type: string
secrets:
GitHubToken:
description: 'GitHub Token which must provide admin permissions to attach a runner to the repository'
required: true
AWSRoleToAssume:
description: 'AWS Role ARN which must provide permissions to attach a runner to the repository (Will be provided within the documentation)'
required: true

permissions:
contents: read
id-token: write

jobs:
add-runner:
name: Add one JIT Runner
runs-on: ubuntu-22.04
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWSRoleToAssume }}
role-session-name: Github_Add_Runner
aws-region: eu-central-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Execute Lambda function
run: |
aws lambda invoke --function-name jit_runner_register_and_create_runner_container --cli-binary-format raw-in-base64-out --payload '{"github_api_secret": "${{ secrets.GitHubToken }}", "count_container": ${{ inputs.RunnerCount }}, "container_compute": "${{ inputs.RunnerComputeType }}", "repository": "${{ github.repository }}" }' response.json
cat response.json
if ! grep -q '"statusCode": 200' response.json; then
echo "Lambda function failed. statusCode is not 200."
exit 1
fi
25 changes: 25 additions & 0 deletions .github/workflows/manual_benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Manual Benchmark
on:
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
add-runner:
uses: ./.github/workflow_templates/runner_attach_workflow.yml
with:
RunnerCount: 1
RunnerComputeType: "S"
secrets:
GitHubToken: ${{ secrets.RUNNER_ATTACH_API_KEY }}
AWSRoleToAssume: ${{ secrets.AWS_ROLE_TO_ASSUME }}

run-test-benchmark:
needs: add-runner
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Run benchmark
run: python3 test.py
Loading

0 comments on commit aad5fa1

Please sign in to comment.