Merge pull request #2 from MealCraft/feautre/test_to_merge

plan work?
This commit is contained in:
Jun-te Kim 2025-12-06 19:46:18 +00:00 committed by GitHub
commit d83e6e4ca8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 58 additions and 23 deletions

View file

@ -1,4 +1,6 @@
FROM library/python:3.12-bullseye
# Personal access token 'mist _runner'
ENV GITHUB_PAT=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
ARG USER=vscode
ARG DEBIAN_FRONTEND=noninteractive

View file

@ -9,20 +9,30 @@ env:
TF_CLOUD_ORGANIZATION: "MealCraft"
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
TF_WORKSPACE: "production"
CONFIG_DIRECTORY: "./"
CONFIG_DIRECTORY: aws_environment
TF_VAR_public_ip: "${{ secrets.PUBLIC_IP }}"
jobs:
terraform:
if: github.repository != 'hashicorp-education/learn-terraform-github-actions'
name: "Terraform Apply"
runs-on: ubuntu-latest
runs-on: mealcraft-runners
container:
image: ghcr.io/catthehacker/ubuntu:runner-22.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug Paths
run: |
echo "Workspace: $GITHUB_WORKSPACE"
ls -R .
echo "CONFIG_DIRECTORY: $CONFIG_DIRECTORY"
ls -R "$CONFIG_DIRECTORY"
- name: Upload Configuration
uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.0.0
id: apply-upload
@ -37,10 +47,14 @@ jobs:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }}
# Terraform marks the run as "confirmable" using lowercase attribute
- name: Apply
if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.is_confirmable
uses: hashicorp/tfc-workflows-github/actions/apply-run@v1.0.0
if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.IsConfirmable
id: apply
with:
comment: "Apply Run from GitHub Actions CI ${{ github.sha }}"
comment: "Apply from GitHub Actions CI ${{ github.sha }}"
run: ${{ steps.apply-run.outputs.run_id }}
- name: Print TF_VAR_public_ip
run: 'echo "📡 Public IP used by Terraform: $TF_VAR_public_ip"'

View file

@ -7,21 +7,28 @@ env:
TF_CLOUD_ORGANIZATION: "MealCraft"
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
TF_WORKSPACE: "production"
CONFIG_DIRECTORY: "./"
CONFIG_DIRECTORY: aws_environment
TF_VAR_public_ip: "${{ secrets.PUBLIC_IP }}"
jobs:
terraform:
if: github.repository != 'hashicorp-education/learn-terraform-github-actions'
name: "Terraform Plan"
runs-on: ubuntu-latest
runs-on: mealcraft-runners
container:
image: ghcr.io/catthehacker/ubuntu:runner-22.04
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug Paths
run: |
echo "Workspace: $GITHUB_WORKSPACE"
ls -R .
echo "CONFIG_DIRECTORY: $CONFIG_DIRECTORY"
ls -R "$CONFIG_DIRECTORY"
- name: Upload Configuration
uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.0.0
id: plan-upload
@ -81,3 +88,4 @@ jobs:
- name: Print TF_VAR_public_ip
run: 'echo "📡 Public IP used by Terraform: $TF_VAR_public_ip"'

View file

@ -6,6 +6,7 @@ on:
jobs:
load-test:
runs-on: mealcraft-runners
container: ubuntu:22.04
strategy:
matrix:
job_id: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

View file

@ -33,3 +33,5 @@ terraform {
required_version = "~> 1.3"
}

View file

@ -1,29 +1,37 @@
#!/bin/bash
set -e
set -ex
echo "=== Enable MicroK8s features ==="
sudo microk8s enable dns rbac hostpath-storage host-access
sudo microk8s enable metrics-server
# OPTIONAL: Enable MicroK8s features first
# sudo microk8s enable dns rbac hostpath-storage host-access
# sudo microk8s enable metrics-server
# OPTIONAL: Configure kubectl
# microk8s kubectl config view --raw > ~/.kube/config
# chmod 600 ~/.kube/config
# sudo usermod -aG microk8s $USER
# sudo chown -f -R $USER ~/.kube
echo "=== Configure kubectl for MicroK8s ==="
microk8s kubectl config view --raw > ~/.kube/config
chmod 600 ~/.kube/config
sudo usermod -aG microk8s $USER
sudo chown -f -R $USER ~/.kube
newgrp microk8s
helm uninstall arc -n arc-systems || true
echo "=== Install Scale Set ARC Controller ==="
echo "=== Install ARC Scale Set Controller ==="
helm install arc \
--namespace arc-systems \
--create-namespace \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
echo "=== Install MealCraft Runner Scale Set ==="
helm uninstall mealcraft-runners -n arc-systems || true
helm install mealcraft-runners \
--namespace arc-systems \
--set githubConfigUrl=https://github.com/MealCraft \
--set githubConfigSecret.github_token=$GITHUB_PAT \
--create-namespace \
--set runnerScaleSetName="mealcraft-runners" \
--set githubConfigUrl="https://github.com/MealCraft" \
--set githubConfigSecret.name="github-secret" \
--set githubConfigSecret.github_token="$GITHUB_PAT" \
--set containerMode.type="kubernetes" \
--set containerMode.kubernetesModeDefaultContainer.image="ubuntu:22.04" \
--set containerMode.kubernetesModeWorkVolumeClaim.accessModes[0]="ReadWriteOnce" \
--set containerMode.kubernetesModeWorkVolumeClaim.storageClassName="microk8s-hostpath" \
--set containerMode.kubernetesModeWorkVolumeClaim.resources.requests.storage="1Gi" \
--set runnerLabels[0]="mealcraft" \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
echo "=== ARC installation complete ==="