Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci.yaml: test aws support #39

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,55 @@ jobs:
- run: ansible-playbook -i "${{ github.workspace }}/inventories/hetzner-cloud/hcloud.yaml" "${{ github.workspace }}/playbook.yaml"
env:
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}

run-asz-with-aws-ec2-x86-64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "The ${{ github.repository }} repository was cloned."

- run: echo "Preparing controller"
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.AWS_SSH_PRIVATE_KEY }}
- run: python3 -m pip -V
- run: python3 -m pip install --user ansible boto3
- run: ansible-galaxy collection install community.general
- run: ansible-galaxy collection install amazon.aws
- run: ansible-config init --disabled > "${{ github.workspace }}/ansible.cfg"
- run: echo "[ssh_connection]" >> "${{ github.workspace }}/ansible.cfg"
- run: echo "ssh_args = -o ServerAliveInterval=10 -o StrictHostKeyChecking=no" >> "${{ github.workspace }}/ansible.cfg"
- run: cp "${{ github.workspace }}/ci/run-asz-with-aws-ec2/aws-ec2.yaml" "${{ github.workspace }}/playbook.yaml"
- run: cp "${{ github.workspace }}/ci/run-asz-with-aws-ec2/config-x86_64.yaml" "${{ github.workspace }}/config.yaml"

- run: echo "Running playbook for x86_64"
- run: ansible-playbook -i "${{ github.workspace }}/inventories/aws-ec2/aws_ec2.yaml" "${{ github.workspace }}/playbook.yaml"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

run-asz-with-aws-ec2-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "The ${{ github.repository }} repository was cloned."

- run: echo "Preparing controller"
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.AWS_SSH_PRIVATE_KEY }}
- run: python3 -m pip -V
- run: python3 -m pip install --user ansible boto3
- run: ansible-galaxy collection install community.general
- run: ansible-galaxy collection install amazon.aws
- run: ansible-config init --disabled > "${{ github.workspace }}/ansible.cfg"
- run: echo "[ssh_connection]" >> "${{ github.workspace }}/ansible.cfg"
- run: echo "ssh_args = -o ServerAliveInterval=10 -o StrictHostKeyChecking=no" >> "${{ github.workspace }}/ansible.cfg"
- run: cp "${{ github.workspace }}/ci/run-asz-with-aws-ec2/aws-ec2.yaml" "${{ github.workspace }}/playbook.yaml"
- run: cp "${{ github.workspace }}/ci/run-asz-with-aws-ec2/config-aarch64.yaml" "${{ github.workspace }}/config.yaml"

- run: echo "Running playbook for aarch64"
- run: ansible-playbook -i "${{ github.workspace }}/inventories/aws-ec2/aws_ec2.yaml" "${{ github.workspace }}/playbook.yaml"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
52 changes: 52 additions & 0 deletions ci/run-asz-with-aws-ec2/aws-ec2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
- name: instantiate-builder
hosts: localhost
roles:
- aws-ec2-instantiate

- name: initiate build
hosts: "asz_server"
remote_user: ec2-user
roles:
- common

- name: prepare sample images
hosts: "asz_server"
remote_user: ec2-user
roles:
- prepare-sample-images

- name: prepare custom images
hosts: "asz_server"
remote_user: ec2-user
roles:
- prepare-custom-images

- name: prepare distro configs
hosts: "asz_server"
remote_user: ec2-user
roles:
- prepare-distro-configs

- name: prepare osbuild
hosts: "asz_server"
remote_user: ec2-user
roles:
- prepare-osbuild

- name: run make
hosts: "asz_server"
remote_user: ec2-user
roles:
- run-make

- name: run make for osbuildvm-images
hosts: "asz_server"
remote_user: ec2-user
roles:
- run-make-osbuildvm

- name: teardown-builder
hosts: localhost
roles:
- aws-ec2-teardown
41 changes: 41 additions & 0 deletions ci/run-asz-with-aws-ec2/config-aarch64-osbuildvm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See docs/config.md for documentation on the different parameters in this file

# == Basic configuration ==

# (optional) Enable building osbuildvm-images
# Leave undefined or set to false to disable
# Resulting VM architecture is based on the build host
target_image: ""
target_arch: aarch64
target_filetype: ""

osbuildvm_images_build: yes

# == Advanced configuration ==
osbuildvm_images_download_baseurl: "https://autosd.sig.centos.org/AutoSD-9/nightly/osbuildvm-images"

osbuild_packages:
- package: "osbuild"
value: "osbuild"
- package: "osbuild-tools"
value: "osbuild-tools"
- package: "osbuild-ostree"
value: "osbuild-ostree"
- package: "osbuild-auto"
value: "osbuild-auto"

sample_images_git_url: "https://gitlab.com/CentOS/automotive/sample-images.git"
sample_images_git_ref: "main"
sample_images_workdir: "{{ ansible_env.HOME }}/zeppelin/sample-images"
sample_images_build_path: "{{ sample_images_workdir }}/osbuild-manifests/_build"

# AWS EC2 configuration
aws_ec2_aarch64_instance_type: "t4g.medium"
aws_ec2_aarch64_ami: "ami-0249b4054bde4661d" # CentOS Stream 9 aarch64 20240212
aws_ec2_aarch64_region: "eu-central-1"
aws_ec2_aarch64_ssh_key: "ci@asz"

aws_ec2_x86_64_instance_type: "t3.medium"
aws_ec2_x86_64_ami: "ami-000dc02a9a29648e7" # CentOS Stream 9 x86_64 20240212
aws_ec2_x86_64_region: "eu-central-1"
aws_ec2_x86_64_ssh_key: "ci@asz"
62 changes: 62 additions & 0 deletions ci/run-asz-with-aws-ec2/config-aarch64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# See docs/config.md for documentation on the different parameters in this file

# == Basic configuration ==

target_image: autosd-qemu-developer-ostree
target_arch: aarch64
target_filetype: qcow2

# (optional) Compress resulting system image file with specified compression
# Leave undefined to have no compression performed
target_compression: gz

# custom_images_git_url: "https://gitlab.com/redhat/edge/ci-cd/pipe-x/custom-images.git"
# custom_images_git_ref: "main"
# custom_images_workdir: "{{ ansible_env.HOME }}/zeppelin/custom-images"

# (optional) Force to use local copy of custom-images
# Leave undefined to clone from custom_images_git_url
# local_custom_images: "{{ ansible_env.HOME }}/custom-images"

# (optional) Force to use local copy of sample-images
# Leave undefined to clone from sample_images_git_url
# local_sample_images: "{{ ansible_env.HOME }}/sample-images"

# (optional) Enable building osbuildvm-images
# Leave undefined or set to false to disable
# Resulting VM architecture is based on the build host
# osbuildvm_images_build: yes

# == Project configurations ==
distros:
- distro_name: autosd
extra_var: "Helloworld!"

# == Advanced configuration ==
osbuildvm_images_download_baseurl: "https://autosd.sig.centos.org/AutoSD-9/nightly/osbuildvm-images"

osbuild_packages:
- package: "osbuild"
value: "osbuild"
- package: "osbuild-tools"
value: "osbuild-tools"
- package: "osbuild-ostree"
value: "osbuild-ostree"
- package: "osbuild-auto"
value: "osbuild-auto"

sample_images_git_url: "https://gitlab.com/CentOS/automotive/sample-images.git"
sample_images_git_ref: "main"
sample_images_workdir: "{{ ansible_env.HOME }}/zeppelin/sample-images"
sample_images_build_path: "{{ sample_images_workdir }}/osbuild-manifests/_build"

# AWS EC2 configuration
aws_ec2_aarch64_instance_type: "t4g.medium"
aws_ec2_aarch64_ami: "ami-0249b4054bde4661d" # CentOS Stream 9 aarch64 20240212
aws_ec2_aarch64_region: "eu-central-1"
aws_ec2_aarch64_ssh_key: "ci@asz"

aws_ec2_x86_64_instance_type: "t3.medium"
aws_ec2_x86_64_ami: "ami-000dc02a9a29648e7" # CentOS Stream 9 x86_64 20240212
aws_ec2_x86_64_region: "eu-central-1"
aws_ec2_x86_64_ssh_key: "ci@asz"
41 changes: 41 additions & 0 deletions ci/run-asz-with-aws-ec2/config-x86_64-osbuildvm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See docs/config.md for documentation on the different parameters in this file

# == Basic configuration ==

# (optional) Enable building osbuildvm-images
# Leave undefined or set to false to disable
# Resulting VM architecture is based on the build host
target_image: ""
target_arch: x86_64
target_filetype: ""

osbuildvm_images_build: yes

# == Advanced configuration ==
osbuildvm_images_download_baseurl: "https://autosd.sig.centos.org/AutoSD-9/nightly/osbuildvm-images"

osbuild_packages:
- package: "osbuild"
value: "osbuild"
- package: "osbuild-tools"
value: "osbuild-tools"
- package: "osbuild-ostree"
value: "osbuild-ostree"
- package: "osbuild-auto"
value: "osbuild-auto"

sample_images_git_url: "https://gitlab.com/CentOS/automotive/sample-images.git"
sample_images_git_ref: "main"
sample_images_workdir: "{{ ansible_env.HOME }}/zeppelin/sample-images"
sample_images_build_path: "{{ sample_images_workdir }}/osbuild-manifests/_build"

# AWS EC2 configuration
aws_ec2_aarch64_instance_type: "t4g.medium"
aws_ec2_aarch64_ami: "ami-0249b4054bde4661d" # CentOS Stream 9 aarch64 20240212
aws_ec2_aarch64_region: "eu-central-1"
aws_ec2_aarch64_ssh_key: "ci@asz"

aws_ec2_x86_64_instance_type: "t3.medium"
aws_ec2_x86_64_ami: "ami-000dc02a9a29648e7" # CentOS Stream 9 x86_64 20240212
aws_ec2_x86_64_region: "eu-central-1"
aws_ec2_x86_64_ssh_key: "ci@asz"
62 changes: 62 additions & 0 deletions ci/run-asz-with-aws-ec2/config-x86_64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# See docs/config.md for documentation on the different parameters in this file

# == Basic configuration ==

target_image: autosd-qemu-developer-ostree
target_arch: x86_64
target_filetype: qcow2

# (optional) Compress resulting system image file with specified compression
# Leave undefined to have no compression performed
target_compression: gz

# custom_images_git_url: "https://gitlab.com/redhat/edge/ci-cd/pipe-x/custom-images.git"
# custom_images_git_ref: "main"
# custom_images_workdir: "{{ ansible_env.HOME }}/zeppelin/custom-images"

# (optional) Force to use local copy of custom-images
# Leave undefined to clone from custom_images_git_url
# local_custom_images: "{{ ansible_env.HOME }}/custom-images"

# (optional) Force to use local copy of sample-images
# Leave undefined to clone from sample_images_git_url
# local_sample_images: "{{ ansible_env.HOME }}/sample-images"

# (optional) Enable building osbuildvm-images
# Leave undefined or set to false to disable
# Resulting VM architecture is based on the build host
# osbuildvm_images_build: yes

# == Project configurations ==
distros:
- distro_name: autosd
extra_var: "Helloworld!"

# == Advanced configuration ==
osbuildvm_images_download_baseurl: "https://autosd.sig.centos.org/AutoSD-9/nightly/osbuildvm-images"

osbuild_packages:
- package: "osbuild"
value: "osbuild"
- package: "osbuild-tools"
value: "osbuild-tools"
- package: "osbuild-ostree"
value: "osbuild-ostree"
- package: "osbuild-auto"
value: "osbuild-auto"

sample_images_git_url: "https://gitlab.com/CentOS/automotive/sample-images.git"
sample_images_git_ref: "main"
sample_images_workdir: "{{ ansible_env.HOME }}/zeppelin/sample-images"
sample_images_build_path: "{{ sample_images_workdir }}/osbuild-manifests/_build"

# AWS EC2 configuration
aws_ec2_aarch64_instance_type: "t4g.medium"
aws_ec2_aarch64_ami: "ami-0249b4054bde4661d" # CentOS Stream 9 aarch64 20240212
aws_ec2_aarch64_region: "eu-central-1"
aws_ec2_aarch64_ssh_key: "ci@asz"

aws_ec2_x86_64_instance_type: "t3.medium"
aws_ec2_x86_64_ami: "ami-000dc02a9a29648e7" # CentOS Stream 9 x86_64 20240212
aws_ec2_x86_64_region: "eu-central-1"
aws_ec2_x86_64_ssh_key: "ci@asz"
Loading