From 5cc12b8c93169ad5df9a5d1a7c4dab4df0241511 Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 7 Mar 2024 01:08:23 -0700 Subject: [PATCH] Update from upstream, streamline collections (#2) Sync with upstream Add customizations: * Update CI for current packages and build pattern * Remove unused ansible collections * Add netaddr python module * Update ansible-core to v2.16.4 (latest release) * Update ansible-runner to v2.3.5 (latest release) * Update receptor to v1.4.4 (latest release) * Update python from 3.9 to 3.12 * Use python3.12 for build env --- .github/workflows/build-latest.yml | 39 ++++++++++++++++++++++++ .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 38 +++++++++++++++++++++++ README.md | 7 ++++- execution-environment.yml | 32 ++++++++++---------- 5 files changed, 148 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/build-latest.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml new file mode 100644 index 0000000..4f28b00 --- /dev/null +++ b/.github/workflows/build-latest.yml @@ -0,0 +1,39 @@ +name: Build and Push latest image + +on: + push: + # build and push anytime commits are merged to main + branches: + - main + +jobs: + build_and_push_latest: + runs-on: ubuntu-22.04 + name: Build and push latest tag from main on new commits + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install -r requirements.txt + + - name: Quay login + run: | + echo "${{ secrets.QUAY_TOKEN }}" | docker login quay.io -u ${{ secrets.QUAY_USERNAME }} --password-stdin + + - name: Build and push image + run: | + docker buildx create --name awx-ee-buildx + docker buildx use awx-ee-buildx + ansible-builder create -v3 --output-file=Dockerfile + docker buildx build \ + --push \ + --platform=linux/amd64 \ + --tag=${{ vars.IMAGE_REGISTRY }}:latest \ + context + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d105d52 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +--- + +name: CI + +on: + pull_request: + branches: + - main + +jobs: + podman: + runs-on: ubuntu-22.04 + name: Podman + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install -r requirements.txt + + - name: Build EE with Podman + run: | + ansible-builder build -v3 -t ${{ vars.IMAGE_REGISTRY }}:latest --container-runtime=podman + + docker: + runs-on: ubuntu-22.04 + name: Docker + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install -r requirements.txt + + - name: Build EE with Docker + run: | + ansible-builder build -v3 -t ${{ vars.IMAGE_REGISTRY }}:latest --container-runtime=docker + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..947b2b3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + release: + types: + - created + +jobs: + release: + runs-on: ubuntu-22.04 + name: Release + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install -r requirements.txt + + - name: Quay login + run: | + echo "${{ secrets.QUAY_TOKEN }}" | docker login quay.io -u ${{ secrets.QUAY_USERNAME }} --password-stdin + + - name: Build and push image + run: | + docker buildx create --name awx-ee-buildx + docker buildx use awx-ee-buildx + ansible-builder create -v3 --output-file=Dockerfile + docker buildx build \ + --push \ + --platform=linux/amd64 \ + --tag=${{ vars.IMAGE_REGISTRY }}:${{ github.event.release.tag_name }} \ + context + diff --git a/README.md b/README.md index a8e40b3..6fe3b5a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AWX EE -The default Execution Environment for AWX. +The InfluxData Execution Environment for AWX. ## Build the image locally @@ -11,3 +11,8 @@ Then run the following command from the root of this repo: ```bash $ ansible-builder build -v3 -t quay.io/ansible/awx-ee # --container-runtime=docker # Is podman by default ``` + +## Build the image via CI + +The Github actions configuration in this repository should work for you as well, provided that you're using that platform. Just updates the secrets to reflect your chosen container repository. + diff --git a/execution-environment.yml b/execution-environment.yml index 28e0954..427e868 100644 --- a/execution-environment.yml +++ b/execution-environment.yml @@ -5,31 +5,25 @@ images: 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.1 + # A minimum of 2.15 is required to get ansible-inventory --limit option + package_pip: ansible-core==2.16.4 ansible_runner: - package_pip: ansible-runner==2.3.3 + package_pip: ansible-runner==2.3.5 + python_interpreter: + package_system: python3.12 + python_path: "/usr/bin/python3.12" galaxy: | --- collections: - name: awx.awx - - name: azure.azcollection - name: amazon.aws - - name: theforeman.foreman - - name: google.cloud - - name: openstack.cloud - - name: community.vmware - - name: ovirt.ovirt - - name: kubernetes.core - name: ansible.posix - - name: ansible.windows - - name: redhatinsights.insights - name: community.general - name: community.docker - - name: amazon.aws + - name: community.aws system: | git-core [platform:rpm] - python3.9-devel [platform:rpm compile] + python3.12-devel [platform:rpm compile] libcurl-devel [platform:rpm compile] krb5-devel [platform:rpm compile] krb5-workstation [platform:rpm] @@ -43,6 +37,12 @@ dependencies: unzip [platform:rpm] jq [platform:rpm] openssl [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] python: | git+https://github.com/ansible/ansible-sign ncclient @@ -59,10 +59,12 @@ dependencies: cryptography>=39.0.0 redis boto3[crt] + receptorctl + netaddr additional_build_steps: append_base: - RUN $PYCMD -m pip install -U pip append_final: - - COPY --from=quay.io/ansible/receptor:v1.4.1 /usr/bin/receptor /usr/bin/receptor + - COPY --from=quay.io/ansible/receptor:v1.4.4 /usr/bin/receptor /usr/bin/receptor - RUN mkdir -p /var/run/receptor - RUN git lfs install --system