From 89ab21f235c221207d59896802d94553ccd822d6 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Wed, 23 Jul 2025 02:01:52 +0400 Subject: [PATCH] feat: ansible docker image --- .github/workflows/distribute.yaml | 40 +++++++++++++++++++++++++------ docker/Dockerfile | 25 +++++++++++++++++++ galaxy.yml | 2 +- 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 docker/Dockerfile diff --git a/.github/workflows/distribute.yaml b/.github/workflows/distribute.yaml index 4ab2bf3..d25531c 100644 --- a/.github/workflows/distribute.yaml +++ b/.github/workflows/distribute.yaml @@ -2,19 +2,45 @@ name: Deploy Collection on: - release: - types: - - published + push: + tags: + - "*.*.*" jobs: - deploy: + release-galaxy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Get the version name from the tags - run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - name: Build and Deploy Collection uses: artis3n/ansible_galaxy_collection@v2 with: api_key: "${{ secrets.GALAXY_API_KEY }}" - galaxy_version: "${{ env.RELEASE_VERSION }}" + galaxy_version: "${{ github.ref_name }}" + + release-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: 🔧 Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: 🔧 Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: 🐋 Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + build-args: VERSION=${{ github.ref_name }} + context: docker + push: true + platforms: linux/amd64,linux/arm64 + tags: | + infisical/ansible-collection:latest + infisical/ansible-collection:${{ github.ref_name }} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..2b81984 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,25 @@ +FROM python:3.11-slim + +ENV PYTHONUNBUFFERED=1 +ENV ANSIBLE_HOST_KEY_CHECKING=false +ENV ANSIBLE_STDOUT_CALLBACK=yaml +ENV ANSIBLE_CALLBACKS_ENABLED=profile_tasks + +ARG VERSION + +RUN apt-get update && apt-get install -y \ + git \ + openssh-client \ + sshpass \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install --no-cache-dir ansible infisicalsdk + +RUN ansible-galaxy collection install infisical.vault==${VERSION} + +WORKDIR /ansible + +RUN mkdir -p /root/.ansible + +# Set default command +CMD ["/bin/bash"] \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 1fb2fe0..f912dc9 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -62,7 +62,7 @@ issues: https://github.com/Infisical/ansible-collection/issues # artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This # uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry', # and '.git' are always filtered. Mutually exclusive with 'manifest' -build_ignore: [] +build_ignore: ["/docker/*"] # A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a # list of MANIFEST.in style # L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key