diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 306cb4e..9198eaf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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/ssh-agent@v0.7.0 + 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/ssh-agent@v0.7.0 + 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 }} diff --git a/ci/run-asz-with-aws-ec2/aws-ec2.yaml b/ci/run-asz-with-aws-ec2/aws-ec2.yaml new file mode 100644 index 0000000..d8b9ebd --- /dev/null +++ b/ci/run-asz-with-aws-ec2/aws-ec2.yaml @@ -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 diff --git a/ci/run-asz-with-aws-ec2/config-aarch64-osbuildvm.yaml b/ci/run-asz-with-aws-ec2/config-aarch64-osbuildvm.yaml new file mode 100644 index 0000000..b8facdc --- /dev/null +++ b/ci/run-asz-with-aws-ec2/config-aarch64-osbuildvm.yaml @@ -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" diff --git a/ci/run-asz-with-aws-ec2/config-aarch64.yaml b/ci/run-asz-with-aws-ec2/config-aarch64.yaml new file mode 100644 index 0000000..03bebfe --- /dev/null +++ b/ci/run-asz-with-aws-ec2/config-aarch64.yaml @@ -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" diff --git a/ci/run-asz-with-aws-ec2/config-x86_64-osbuildvm.yaml b/ci/run-asz-with-aws-ec2/config-x86_64-osbuildvm.yaml new file mode 100644 index 0000000..146ff76 --- /dev/null +++ b/ci/run-asz-with-aws-ec2/config-x86_64-osbuildvm.yaml @@ -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" diff --git a/ci/run-asz-with-aws-ec2/config-x86_64.yaml b/ci/run-asz-with-aws-ec2/config-x86_64.yaml new file mode 100644 index 0000000..4fe0901 --- /dev/null +++ b/ci/run-asz-with-aws-ec2/config-x86_64.yaml @@ -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"