ci: migrate workflows and dependencies to Gitea
This commit is contained in:
10 files changed
+254716
-124
No files matched your search
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2018 GitHub, Inc. and contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "ci-action-gitea-download-artifact",
|
||||||
|
"source": "https://github.com/christopherhx/gitea-download-artifact.git",
|
||||||
|
"requested_ref": "v4",
|
||||||
|
"commit": "75635f32b4c1c41c4b3d64e8f85210112ed4c9c7",
|
||||||
|
"path": "/private/tmp/gitea-migration-20261105/mirrors/ci-action-gitea-download-artifact.git",
|
||||||
|
"destination": "https://git.ermnvldmr.com/deytenit/ci-action-gitea-download-artifact"
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
name: 'Download a Build Artifact'
|
||||||
|
description: 'Download a build artifact that was previously uploaded in the workflow by the upload-artifact action'
|
||||||
|
author: 'GitHub'
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
description: 'Name of the artifact to download. If unspecified, all artifacts for the run are downloaded.'
|
||||||
|
required: false
|
||||||
|
path:
|
||||||
|
description: 'Destination path. Supports basic tilde expansion. Defaults to $GITHUB_WORKSPACE'
|
||||||
|
required: false
|
||||||
|
pattern:
|
||||||
|
description: 'A glob pattern matching the artifacts that should be downloaded. Ignored if name is specified.'
|
||||||
|
required: false
|
||||||
|
merge-multiple:
|
||||||
|
description: 'When multiple artifacts are matched, this changes the behavior of the destination directories.
|
||||||
|
If true, the downloaded artifacts will be in the same directory specified by path.
|
||||||
|
If false, the downloaded artifacts will be extracted into individual named directories within the specified path.'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
github-token:
|
||||||
|
description: 'The GitHub token used to authenticate with the GitHub API.
|
||||||
|
This is required when downloading artifacts from a different repository or from a different workflow run.
|
||||||
|
If this is not specified, the action will attempt to download artifacts from the current repository and the current workflow run.'
|
||||||
|
required: false
|
||||||
|
repository:
|
||||||
|
description: 'The repository owner and the repository name joined together by "/".
|
||||||
|
If github-token is specified, this is the repository that artifacts will be downloaded from.'
|
||||||
|
required: false
|
||||||
|
default: ${{ github.repository }}
|
||||||
|
run-id:
|
||||||
|
description: 'The id of the workflow run where the desired download artifact was uploaded from.
|
||||||
|
If github-token is specified, this is the run that artifacts will be downloaded from.'
|
||||||
|
required: false
|
||||||
|
default: ${{ github.run_id }}
|
||||||
|
outputs:
|
||||||
|
download-path:
|
||||||
|
description: 'Path of artifact download'
|
||||||
|
runs:
|
||||||
|
using: 'node20'
|
||||||
|
main: 'dist/index.js'
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2018 GitHub, Inc. and contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "ci-action-gitea-upload-artifact",
|
||||||
|
"source": "https://github.com/christopherhx/gitea-upload-artifact.git",
|
||||||
|
"requested_ref": "v4",
|
||||||
|
"commit": "81f940d004763f986ba3582c007fd842dd5cb0d7",
|
||||||
|
"path": "/private/tmp/gitea-migration-20261105/mirrors/ci-action-gitea-upload-artifact.git",
|
||||||
|
"destination": "https://git.ermnvldmr.com/deytenit/ci-action-gitea-upload-artifact"
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
name: 'Upload a Build Artifact'
|
||||||
|
description: 'Upload a build artifact that can be used by subsequent workflow steps'
|
||||||
|
author: 'GitHub'
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
description: 'Artifact name'
|
||||||
|
default: 'artifact'
|
||||||
|
path:
|
||||||
|
description: 'A file, directory or wildcard pattern that describes what to upload'
|
||||||
|
required: true
|
||||||
|
if-no-files-found:
|
||||||
|
description: >
|
||||||
|
The desired behavior if no files are found using the provided path.
|
||||||
|
|
||||||
|
Available Options:
|
||||||
|
warn: Output a warning but do not fail the action
|
||||||
|
error: Fail the action with an error message
|
||||||
|
ignore: Do not output any warnings or errors, the action does not fail
|
||||||
|
default: 'warn'
|
||||||
|
retention-days:
|
||||||
|
description: >
|
||||||
|
Duration after which artifact will expire in days. 0 means using default retention.
|
||||||
|
|
||||||
|
Minimum 1 day.
|
||||||
|
Maximum 90 days unless changed from the repository settings page.
|
||||||
|
compression-level:
|
||||||
|
description: >
|
||||||
|
The level of compression for Zlib to be applied to the artifact archive.
|
||||||
|
The value can range from 0 to 9:
|
||||||
|
- 0: No compression
|
||||||
|
- 1: Best speed
|
||||||
|
- 6: Default compression (same as GNU Gzip)
|
||||||
|
- 9: Best compression
|
||||||
|
Higher levels will result in better compression, but will take longer to complete.
|
||||||
|
For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.
|
||||||
|
default: '6'
|
||||||
|
overwrite:
|
||||||
|
description: >
|
||||||
|
If true, an artifact with a matching name will be deleted before a new one is uploaded.
|
||||||
|
If false, the action will fail if an artifact for the given name already exists.
|
||||||
|
Does not fail if the artifact does not exist.
|
||||||
|
default: 'false'
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
artifact-id:
|
||||||
|
description: >
|
||||||
|
A unique identifier for the artifact that was just uploaded. Empty if the artifact upload failed.
|
||||||
|
|
||||||
|
This ID can be used as input to other APIs to download, delete or get more information about an artifact: https://docs.github.com/en/rest/actions/artifacts
|
||||||
|
artifact-url:
|
||||||
|
description: >
|
||||||
|
A download URL for the artifact that was just uploaded. Empty if the artifact upload failed.
|
||||||
|
|
||||||
|
This download URL only works for requests Authenticated with GitHub. Anonymous downloads will be prompted to first login.
|
||||||
|
If an anonymous download URL is needed than a short time restricted URL can be generated using the download artifact API: https://docs.github.com/en/rest/actions/artifacts#download-an-artifact
|
||||||
|
|
||||||
|
This URL will be valid for as long as the artifact exists and the workflow run and repository exists. Once an artifact has expired this URL will no longer work.
|
||||||
|
Common uses cases for such a download URL can be adding download links to artifacts in descriptions or comments on pull requests or issues.
|
||||||
|
runs:
|
||||||
|
using: 'node20'
|
||||||
|
main: 'dist/index.js'
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,179 @@
|
|||||||
|
name: ci/packer - main/manual-build-golden-image
|
||||||
|
'on':
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
upload_s3:
|
||||||
|
description: Upload built image to specified static S3 Object Storage
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
concurrency:
|
||||||
|
group: ci-golden-image
|
||||||
|
cancel-in-progress: false
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
jobs:
|
||||||
|
validate-scripts:
|
||||||
|
name: 'Validate: Provisioner Scripts'
|
||||||
|
runs-on: apex-debian13
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
run: "set -euo pipefail\ncase \"$CHECKOUT_REF\" in -*) exit 1;; esac\nGITHUB_SERVER_URL=${GITHUB_SERVER_URL%/}\n\
|
||||||
|
case \"$GITHUB_SERVER_URL\" in https://git.ermnvldmr.com) ;; *) exit 1;; esac\n\
|
||||||
|
AUTH=$(printf 'deytenit:%s' \"$CHECKOUT_TOKEN\" | base64 -w0)\nHEADER=\"http.${GITHUB_SERVER_URL}/.extraheader=AUTHORIZATION:\
|
||||||
|
\ basic $AUTH\"\ngit init \"$GITHUB_WORKSPACE\"\ncd \"$GITHUB_WORKSPACE\"\n\
|
||||||
|
git remote add origin \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git\"\ngit -c\
|
||||||
|
\ \"$HEADER\" fetch --tags origin '+refs/heads/*:refs/remotes/origin/*'\n\
|
||||||
|
git -c \"$HEADER\" fetch origin \"$CHECKOUT_REF\"\ngit checkout --detach FETCH_HEAD\n\
|
||||||
|
test \"$(git rev-parse HEAD)\" = \"$GITHUB_SHA\"\nif [ \"$CHECKOUT_SUBMODULES\"\
|
||||||
|
\ = recursive ]; then\n key_file=$(mktemp \"${RUNNER_TEMP:-/tmp}/hextra-key.XXXXXX\"\
|
||||||
|
)\n trap 'rm -f \"$key_file\"' EXIT\n umask 077\n printf '%s\\n'\
|
||||||
|
\ \"$HEXTRA_READ_KEY\" > \"$key_file\"\n chmod 600 \"$key_file\"\n export\
|
||||||
|
\ GIT_SSH_COMMAND=\"ssh -T -i $key_file -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes\
|
||||||
|
\ -o HostKeyAlgorithms=ssh-ed25519 -o UserKnownHostsFile=$GITHUB_WORKSPACE/.gitea/known_hosts\"\
|
||||||
|
\n git submodule update --init --recursive\nfi\nif [ \"$PERSIST_CREDENTIALS\"\
|
||||||
|
\ = true ]; then\n git config \"http.${GITHUB_SERVER_URL}/.extraheader\"\
|
||||||
|
\ \"AUTHORIZATION: basic $AUTH\"\nfi\n"
|
||||||
|
env:
|
||||||
|
CHECKOUT_REF: ${{ github.sha }}
|
||||||
|
CHECKOUT_SUBMODULES: 'false'
|
||||||
|
CHECKOUT_TOKEN: ${{ github.token }}
|
||||||
|
PERSIST_CREDENTIALS: 'false'
|
||||||
|
HEXTRA_READ_KEY: ''
|
||||||
|
- name: Setup Python
|
||||||
|
run: python3 -c "import sys; assert sys.version_info >= (3, 10)"
|
||||||
|
- name: Install Developer Dependencies
|
||||||
|
run: python3 -m pip install ruff==0.17.2 "PyYAML>=6.0,<7"
|
||||||
|
- name: Validate Shell Script Syntax
|
||||||
|
run: "for script in ci/packer/scripts/*.sh ci/scripts/init-node/provisioning/seed.sh;\
|
||||||
|
\ do\n bash -n \"$script\"\ndone\nmake check\n"
|
||||||
|
- name: Setup Packer
|
||||||
|
run: 'packer version
|
||||||
|
|
||||||
|
packer plugins installed | grep qemu'
|
||||||
|
- name: Validate Packer Template
|
||||||
|
run: 'packer plugins installed | grep qemu
|
||||||
|
|
||||||
|
packer validate ci/packer/apex-debian-13.pkr.hcl
|
||||||
|
|
||||||
|
'
|
||||||
|
build-image:
|
||||||
|
name: 'Build: Golden Image'
|
||||||
|
needs: validate-scripts
|
||||||
|
runs-on: apex-debian13
|
||||||
|
outputs:
|
||||||
|
image_name: ${{ steps.vars.outputs.image_name }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
run: "set -euo pipefail\ncase \"$CHECKOUT_REF\" in -*) exit 1;; esac\nGITHUB_SERVER_URL=${GITHUB_SERVER_URL%/}\n\
|
||||||
|
case \"$GITHUB_SERVER_URL\" in https://git.ermnvldmr.com) ;; *) exit 1;; esac\n\
|
||||||
|
AUTH=$(printf 'deytenit:%s' \"$CHECKOUT_TOKEN\" | base64 -w0)\nHEADER=\"http.${GITHUB_SERVER_URL}/.extraheader=AUTHORIZATION:\
|
||||||
|
\ basic $AUTH\"\ngit init \"$GITHUB_WORKSPACE\"\ncd \"$GITHUB_WORKSPACE\"\n\
|
||||||
|
git remote add origin \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git\"\ngit -c\
|
||||||
|
\ \"$HEADER\" fetch --tags origin '+refs/heads/*:refs/remotes/origin/*'\n\
|
||||||
|
git -c \"$HEADER\" fetch origin \"$CHECKOUT_REF\"\ngit checkout --detach FETCH_HEAD\n\
|
||||||
|
test \"$(git rev-parse HEAD)\" = \"$GITHUB_SHA\"\nif [ \"$CHECKOUT_SUBMODULES\"\
|
||||||
|
\ = recursive ]; then\n key_file=$(mktemp \"${RUNNER_TEMP:-/tmp}/hextra-key.XXXXXX\"\
|
||||||
|
)\n trap 'rm -f \"$key_file\"' EXIT\n umask 077\n printf '%s\\n'\
|
||||||
|
\ \"$HEXTRA_READ_KEY\" > \"$key_file\"\n chmod 600 \"$key_file\"\n export\
|
||||||
|
\ GIT_SSH_COMMAND=\"ssh -T -i $key_file -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes\
|
||||||
|
\ -o HostKeyAlgorithms=ssh-ed25519 -o UserKnownHostsFile=$GITHUB_WORKSPACE/.gitea/known_hosts\"\
|
||||||
|
\n git submodule update --init --recursive\nfi\nif [ \"$PERSIST_CREDENTIALS\"\
|
||||||
|
\ = true ]; then\n git config \"http.${GITHUB_SERVER_URL}/.extraheader\"\
|
||||||
|
\ \"AUTHORIZATION: basic $AUTH\"\nfi\n"
|
||||||
|
env:
|
||||||
|
CHECKOUT_REF: ${{ github.sha }}
|
||||||
|
CHECKOUT_SUBMODULES: 'false'
|
||||||
|
CHECKOUT_TOKEN: ${{ github.token }}
|
||||||
|
PERSIST_CREDENTIALS: 'false'
|
||||||
|
HEXTRA_READ_KEY: ''
|
||||||
|
- name: Compute Image Metadata
|
||||||
|
id: vars
|
||||||
|
run: 'SHORT_SHA="$(echo ${{ github.sha }} | cut -c1-7)"
|
||||||
|
|
||||||
|
IMAGE_NAME="com-ermnvldmr-apex-debian-13-amd64-${SHORT_SHA}.qcow2"
|
||||||
|
|
||||||
|
echo "image_name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
'
|
||||||
|
- name: Install QEMU & Build Tools
|
||||||
|
run: 'sudo apt-get update
|
||||||
|
|
||||||
|
sudo apt-get install -y qemu-system-x86 qemu-utils xorriso
|
||||||
|
|
||||||
|
sudo chmod 666 /dev/kvm 2>/dev/null || true
|
||||||
|
|
||||||
|
'
|
||||||
|
- name: Setup Packer
|
||||||
|
run: 'packer version
|
||||||
|
|
||||||
|
packer plugins installed | grep qemu'
|
||||||
|
- name: Build Debian 13 Image with Packer
|
||||||
|
run: 'packer plugins installed | grep qemu
|
||||||
|
|
||||||
|
packer build -var "vm_name=${{ steps.vars.outputs.image_name }}" -var "provision_revision=${{
|
||||||
|
github.sha }}" ci/packer/apex-debian-13.pkr.hcl
|
||||||
|
|
||||||
|
'
|
||||||
|
- name: Upload Image Artifact
|
||||||
|
uses: ./.gitea/actions/upload-artifact
|
||||||
|
with:
|
||||||
|
name: golden-image
|
||||||
|
path: output-qemu/${{ steps.vars.outputs.image_name }}
|
||||||
|
retention-days: 30
|
||||||
|
upload-s3:
|
||||||
|
name: 'Upload: S3 Storage'
|
||||||
|
needs: build-image
|
||||||
|
if: inputs.upload_s3 == true
|
||||||
|
runs-on: apex-debian13
|
||||||
|
steps:
|
||||||
|
- run: "set -euo pipefail\ncase \"$CHECKOUT_REF\" in -*) exit 1;; esac\nGITHUB_SERVER_URL=${GITHUB_SERVER_URL%/}\n\
|
||||||
|
case \"$GITHUB_SERVER_URL\" in https://git.ermnvldmr.com) ;; *) exit 1;; esac\n\
|
||||||
|
AUTH=$(printf 'deytenit:%s' \"$CHECKOUT_TOKEN\" | base64 -w0)\nHEADER=\"http.${GITHUB_SERVER_URL}/.extraheader=AUTHORIZATION:\
|
||||||
|
\ basic $AUTH\"\ngit init \"$GITHUB_WORKSPACE\"\ncd \"$GITHUB_WORKSPACE\"\n\
|
||||||
|
git remote add origin \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git\"\ngit -c\
|
||||||
|
\ \"$HEADER\" fetch --tags origin '+refs/heads/*:refs/remotes/origin/*'\n\
|
||||||
|
git -c \"$HEADER\" fetch origin \"$CHECKOUT_REF\"\ngit checkout --detach FETCH_HEAD\n\
|
||||||
|
test \"$(git rev-parse HEAD)\" = \"$GITHUB_SHA\"\nif [ \"$CHECKOUT_SUBMODULES\"\
|
||||||
|
\ = recursive ]; then\n key_file=$(mktemp \"${RUNNER_TEMP:-/tmp}/hextra-key.XXXXXX\"\
|
||||||
|
)\n trap 'rm -f \"$key_file\"' EXIT\n umask 077\n printf '%s\\n'\
|
||||||
|
\ \"$HEXTRA_READ_KEY\" > \"$key_file\"\n chmod 600 \"$key_file\"\n export\
|
||||||
|
\ GIT_SSH_COMMAND=\"ssh -T -i $key_file -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes\
|
||||||
|
\ -o HostKeyAlgorithms=ssh-ed25519 -o UserKnownHostsFile=$GITHUB_WORKSPACE/.gitea/known_hosts\"\
|
||||||
|
\n git submodule update --init --recursive\nfi\nif [ \"$PERSIST_CREDENTIALS\"\
|
||||||
|
\ = true ]; then\n git config \"http.${GITHUB_SERVER_URL}/.extraheader\"\
|
||||||
|
\ \"AUTHORIZATION: basic $AUTH\"\nfi\n"
|
||||||
|
env:
|
||||||
|
CHECKOUT_REF: ${{ github.sha }}
|
||||||
|
CHECKOUT_SUBMODULES: 'false'
|
||||||
|
CHECKOUT_TOKEN: ${{ github.token }}
|
||||||
|
PERSIST_CREDENTIALS: 'false'
|
||||||
|
HEXTRA_READ_KEY: ''
|
||||||
|
- name: Download Image Artifact
|
||||||
|
uses: ./.gitea/actions/download-artifact
|
||||||
|
with:
|
||||||
|
name: golden-image
|
||||||
|
path: output-qemu
|
||||||
|
- name: Upload to Static S3 (/dev/images/)
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.STATIC_AWS_ACCESS_KEY_ID || secrets.COM_ERMNVLDMR_STATIC_AWS_ACCESS_KEY_ID
|
||||||
|
}}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.STATIC_AWS_SECRET_ACCESS_KEY || secrets.COM_ERMNVLDMR_STATIC_AWS_SECRET_ACCESS_KEY
|
||||||
|
}}
|
||||||
|
AWS_DEFAULT_REGION: ${{ secrets.STATIC_AWS_REGION || secrets.COM_ERMNVLDMR_STATIC_S3_REGION
|
||||||
|
|| 'auto' }}
|
||||||
|
S3_ENDPOINT: ${{ secrets.STATIC_S3_ENDPOINT_URL || secrets.COM_ERMNVLDMR_STATIC_S3_ENDPOINT_URL
|
||||||
|
}}
|
||||||
|
S3_BUCKET: ${{ secrets.STATIC_S3_BUCKET || secrets.COM_ERMNVLDMR_STATIC_S3_BUCKET
|
||||||
|
}}
|
||||||
|
IMAGE_NAME: ${{ needs.build-image.outputs.image_name }}
|
||||||
|
run: "if [ -n \"${S3_BUCKET}\" ] && [ -n \"${AWS_ACCESS_KEY_ID}\" ]; then\n\
|
||||||
|
\ ENDPOINT_FLAG=\"\"\n if [ -n \"${S3_ENDPOINT}\" ]; then\n ENDPOINT_FLAG=\"\
|
||||||
|
--endpoint-url=${S3_ENDPOINT}\"\n fi\n echo \"Cleaning up older builds in\
|
||||||
|
\ dev/images/com-ermnvldmr-apex-debian-13-amd64-*.qcow2 to maintain quota...\"\
|
||||||
|
\n aws ${ENDPOINT_FLAG} s3 rm \"s3://${S3_BUCKET}/dev/images/\" --recursive\
|
||||||
|
\ --exclude \"*\" --include \"com-ermnvldmr-apex-debian-13-amd64-*.qcow2\"\
|
||||||
|
\ || true\n echo \"Uploading ${IMAGE_NAME}...\"\n aws ${ENDPOINT_FLAG} s3\
|
||||||
|
\ cp \"output-qemu/${IMAGE_NAME}\" \"s3://${S3_BUCKET}/dev/images/${IMAGE_NAME}\"\
|
||||||
|
\n echo \"Golden image uploaded successfully to s3://${S3_BUCKET}/dev/images/${IMAGE_NAME}\"\
|
||||||
|
\nelse\n echo \"S3 credentials not configured; skipping upload. Image artifact\
|
||||||
|
\ preserved in GitHub Actions run.\"\nfi\n"
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
name: ci/packer - main/manual-build-golden-image
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
upload_s3:
|
|
||||||
description: "Upload built image to specified static S3 Object Storage"
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ci-golden-image
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate-scripts:
|
|
||||||
name: "Validate: Provisioner Scripts"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
|
|
||||||
- name: Install Developer Dependencies
|
|
||||||
run: python3 -m pip install ruff==0.17.2 "PyYAML>=6.0,<7"
|
|
||||||
|
|
||||||
- name: Validate Shell Script Syntax
|
|
||||||
run: |
|
|
||||||
for script in ci/packer/scripts/*.sh ci/scripts/init-node/provisioning/seed.sh; do
|
|
||||||
bash -n "$script"
|
|
||||||
done
|
|
||||||
make check
|
|
||||||
|
|
||||||
- name: Setup Packer
|
|
||||||
uses: hashicorp/setup-packer@main
|
|
||||||
with:
|
|
||||||
version: "latest"
|
|
||||||
|
|
||||||
- name: Validate Packer Template
|
|
||||||
run: |
|
|
||||||
packer init ci/packer/apex-debian-13.pkr.hcl
|
|
||||||
packer validate ci/packer/apex-debian-13.pkr.hcl
|
|
||||||
|
|
||||||
build-image:
|
|
||||||
name: "Build: Golden Image"
|
|
||||||
needs: validate-scripts
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
outputs:
|
|
||||||
image_name: ${{ steps.vars.outputs.image_name }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Compute Image Metadata
|
|
||||||
id: vars
|
|
||||||
run: |
|
|
||||||
SHORT_SHA="$(echo ${{ github.sha }} | cut -c1-7)"
|
|
||||||
IMAGE_NAME="com-ermnvldmr-apex-debian-13-amd64-${SHORT_SHA}.qcow2"
|
|
||||||
echo "image_name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Install QEMU & Build Tools
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y qemu-system-x86 qemu-utils xorriso
|
|
||||||
sudo chmod 666 /dev/kvm 2>/dev/null || true
|
|
||||||
|
|
||||||
- name: Setup Packer
|
|
||||||
uses: hashicorp/setup-packer@main
|
|
||||||
with:
|
|
||||||
version: "latest"
|
|
||||||
|
|
||||||
- name: Build Debian 13 Image with Packer
|
|
||||||
run: |
|
|
||||||
packer init ci/packer/apex-debian-13.pkr.hcl
|
|
||||||
packer build -var "vm_name=${{ steps.vars.outputs.image_name }}" -var "provision_revision=${{ github.sha }}" ci/packer/apex-debian-13.pkr.hcl
|
|
||||||
|
|
||||||
- name: Upload Image Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: golden-image
|
|
||||||
path: output-qemu/${{ steps.vars.outputs.image_name }}
|
|
||||||
retention-days: 2
|
|
||||||
|
|
||||||
upload-s3:
|
|
||||||
name: "Upload: S3 Storage"
|
|
||||||
needs: build-image
|
|
||||||
if: inputs.upload_s3 == true
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Download Image Artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: golden-image
|
|
||||||
path: output-qemu
|
|
||||||
|
|
||||||
- name: Upload to Static S3 (/dev/images/)
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.STATIC_AWS_ACCESS_KEY_ID || secrets.COM_ERMNVLDMR_STATIC_AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.STATIC_AWS_SECRET_ACCESS_KEY || secrets.COM_ERMNVLDMR_STATIC_AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.STATIC_AWS_REGION || secrets.COM_ERMNVLDMR_STATIC_S3_REGION || 'auto' }}
|
|
||||||
S3_ENDPOINT: ${{ secrets.STATIC_S3_ENDPOINT_URL || secrets.COM_ERMNVLDMR_STATIC_S3_ENDPOINT_URL }}
|
|
||||||
S3_BUCKET: ${{ secrets.STATIC_S3_BUCKET || secrets.COM_ERMNVLDMR_STATIC_S3_BUCKET }}
|
|
||||||
IMAGE_NAME: ${{ needs.build-image.outputs.image_name }}
|
|
||||||
run: |
|
|
||||||
if [ -n "${S3_BUCKET}" ] && [ -n "${AWS_ACCESS_KEY_ID}" ]; then
|
|
||||||
ENDPOINT_FLAG=""
|
|
||||||
if [ -n "${S3_ENDPOINT}" ]; then
|
|
||||||
ENDPOINT_FLAG="--endpoint-url=${S3_ENDPOINT}"
|
|
||||||
fi
|
|
||||||
echo "Cleaning up older builds in dev/images/com-ermnvldmr-apex-debian-13-amd64-*.qcow2 to maintain quota..."
|
|
||||||
aws ${ENDPOINT_FLAG} s3 rm "s3://${S3_BUCKET}/dev/images/" --recursive --exclude "*" --include "com-ermnvldmr-apex-debian-13-amd64-*.qcow2" || true
|
|
||||||
echo "Uploading ${IMAGE_NAME}..."
|
|
||||||
aws ${ENDPOINT_FLAG} s3 cp "output-qemu/${IMAGE_NAME}" "s3://${S3_BUCKET}/dev/images/${IMAGE_NAME}"
|
|
||||||
echo "Golden image uploaded successfully to s3://${S3_BUCKET}/dev/images/${IMAGE_NAME}"
|
|
||||||
else
|
|
||||||
echo "S3 credentials not configured; skipping upload. Image artifact preserved in GitHub Actions run."
|
|
||||||
fi
|
|
||||||
Reference in new issue
Block a user