From 18a3aae8ea34ec649f07130c4511678efac8a5c9 Mon Sep 17 00:00:00 2001 From: Taylor Mansfield <962444+lavahot@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:35:54 -0800 Subject: [PATCH] Add execution environment --- .github/workflows/execution-environment.yml | 49 +++++++++++++++++++ .gitignore | 3 ++ execution-environment.yml | 52 +++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 .github/workflows/execution-environment.yml create mode 100644 execution-environment.yml diff --git a/.github/workflows/execution-environment.yml b/.github/workflows/execution-environment.yml new file mode 100644 index 00000000000..b79d51282fb --- /dev/null +++ b/.github/workflows/execution-environment.yml @@ -0,0 +1,49 @@ +name: Build and Publish Ansible Image + +on: + push: + branches: + - main + + pull_request: + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Install ansible-builder + run: pip install ansible-builder + + - name: Build Ansible Image + run: ansible-builder build --tag kubespray-ee:${{ github.sha }} + + - name: Tag image with PR name + if: github.event_name == 'pull_request' + run: docker tag kubespray-ee:${{ github.sha }} kubespray-ee:pr-${{ github.event.number }} + + - name: Tag image with branch name + if: github.event_name == 'push' + run: docker tag kubespray-ee:${{ github.sha }} kubespray-ee:${{ github.ref }} + + - name: Tag image with latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: docker tag kubespray-ee:${{ github.sha }} kubespray-ee:latest + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push Image to GitHub Container Registry + run: docker push -a ghcr.io/${{ github.repository_owner }}/kubespray-ee:${{ github.sha }} diff --git a/.gitignore b/.gitignore index fa68d5606e9..67760557ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,6 @@ tmp.md # Ansible collection files kubernetes_sigs-kubespray*tar.gz ansible_collections + +# Ansible-builder files +context/ diff --git a/execution-environment.yml b/execution-environment.yml new file mode 100644 index 00000000000..1e1f9f838b7 --- /dev/null +++ b/execution-environment.yml @@ -0,0 +1,52 @@ +--- +version: 3 + +images: + base_image: + name: quay.io/centos/centos:stream9 + +dependencies: + ansible_core: + # Require minimum of 2.15 to get ansible-inventory --limit option + package_pip: ansible-core>=2.15.5,<2.16 + ansible_runner: + package_pip: ansible-runner + python: requirements.txt + # git+https://github.com/ansible/ansible-sign + # ncclient + # paramiko + # pykerberos + # pyOpenSSL + # pypsrp[kerberos,credssp] + # pywinrm[kerberos,credssp] + # toml + # pexpect>=4.5 + # python-daemon + # pyyaml + # six + # receptorctl + system: | + git-core [platform:rpm] + python3.9-devel [platform:rpm compile] + libcurl-devel [platform:rpm compile] + krb5-devel [platform:rpm compile] + krb5-workstation [platform:rpm] + subversion [platform:rpm] + subversion [platform:dpkg] + git-lfs [platform:rpm] + sshpass [platform:rpm] + rsync [platform:rpm] + epel-release [platform:rpm] + python-unversioned-command [platform:rpm] + unzip [platform:rpm] + podman-remote [platform:rpm] + cmake [platform:rpm compile] + gcc [platform:rpm compile] + gcc-c++ [platform:rpm compile] + make [platform:rpm compile] + openssl-devel [platform:rpm compile] + +additional_build_steps: + + append_base: + - RUN $PYCMD -m pip install -U pip \ No newline at end of file