mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-16 12:06:29 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e02d4d06af | ||
|
|
15690313f3 | ||
|
|
241ba443ac | ||
|
|
67448fd5bb |
35
.github/workflows/docker-images.yml
vendored
35
.github/workflows/docker-images.yml
vendored
@ -28,7 +28,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build image ${{ matrix.name }}:${{ matrix.tag }}
|
name: Build image ${{ matrix.name }}:${{ matrix.tag }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -53,10 +53,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get install podman buildah
|
sudo apt-get install podman buildah
|
||||||
|
|
||||||
- name: Set up Go 1.22
|
- name: Set up Go 1.26
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: '1.22'
|
go-version: '1.26'
|
||||||
cache: false # true (default) results in warnings since we don't use Go modules
|
cache: false # true (default) results in warnings since we don't use Go modules
|
||||||
|
|
||||||
- name: Build ${{ matrix.name }} image
|
- name: Build ${{ matrix.name }} image
|
||||||
@ -66,25 +66,22 @@ jobs:
|
|||||||
|
|
||||||
- name: Tag image as latest
|
- name: Tag image as latest
|
||||||
if: matrix.tag-as-latest && matrix.tag != 'latest'
|
if: matrix.tag-as-latest && matrix.tag != 'latest'
|
||||||
run: |
|
env:
|
||||||
podman tag "${CONTAINER_REGISTRY}/${{ matrix.name }}:${{ matrix.tag }}" "${CONTAINER_REGISTRY}/${{ matrix.name }}:latest"
|
SOURCE_IMAGE: ${{ matrix.name }}:${{ matrix.tag }}
|
||||||
|
DEST_IMAGE: ${{ matrix.name }}:latest
|
||||||
|
run: >-
|
||||||
|
podman tag "${CONTAINER_REGISTRY}/${SOURCE_IMAGE}" "${CONTAINER_REGISTRY}/${DEST_IMAGE}"
|
||||||
|
|
||||||
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:${{ matrix.tag }}
|
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:${{ matrix.tag }}
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: redhat-actions/push-to-registry@v2
|
env:
|
||||||
with:
|
IMAGE: ${{ matrix.name }}:${{ matrix.tag }}
|
||||||
registry: ${{ env.CONTAINER_REGISTRY }}
|
run: >-
|
||||||
image: ${{ matrix.name }}
|
podman push "${IMAGE}" "${CONTAINER_REGISTRY}/${IMAGE}" --tls-verify=true --creds=${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
|
||||||
tags: ${{ matrix.tag }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:latest
|
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:latest
|
||||||
if: github.event_name != 'pull_request' && matrix.tag-as-latest && matrix.tag != 'latest'
|
if: github.event_name != 'pull_request' && matrix.tag-as-latest && matrix.tag != 'latest'
|
||||||
uses: redhat-actions/push-to-registry@v2
|
env:
|
||||||
with:
|
IMAGE: ${{ matrix.name }}:latest
|
||||||
registry: ${{ env.CONTAINER_REGISTRY }}
|
run: >-
|
||||||
image: ${{ matrix.name }}
|
podman push "${IMAGE}" "${CONTAINER_REGISTRY}/${IMAGE}" --tls-verify=true --creds=${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
|
||||||
tags: latest
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|||||||
23
.github/workflows/nox.yml
vendored
23
.github/workflows/nox.yml
vendored
@ -31,5 +31,28 @@ jobs:
|
|||||||
upload-codecov-push: false
|
upload-codecov-push: false
|
||||||
upload-codecov-schedule: true
|
upload-codecov-schedule: true
|
||||||
max-ansible-core: "2.17"
|
max-ansible-core: "2.17"
|
||||||
|
# For some reason GitHub decided to bump Docker on the ubuntu-24.04 image,
|
||||||
|
# which is not compatible with podman and various other things.
|
||||||
|
pre-test-cmd-integration: |-
|
||||||
|
# See https://docs.docker.com/engine/install/ubuntu/.
|
||||||
|
|
||||||
|
# Add Docker's official GPG key:
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install ca-certificates curl
|
||||||
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
|
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
|
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||||
|
|
||||||
|
# Add the repository to Apt sources:
|
||||||
|
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
|
||||||
|
Types: deb
|
||||||
|
URIs: https://download.docker.com/linux/ubuntu
|
||||||
|
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
|
||||||
|
Components: stable
|
||||||
|
Signed-By: /etc/apt/keyrings/docker.asc
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt-get install -y --allow-downgrades docker-ce-cli=5:28.0.4-1~ubuntu.24.04~noble docker-ce=5:28.0.4-1~ubuntu.24.04~noble
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
2
changelogs/fragments/1248-ignore-pull-failures.yml
Normal file
2
changelogs/fragments/1248-ignore-pull-failures.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- docker_compose_v2_pull - adds ``ignore_pull_failures`` parameter that passes ``--ignore-pull-failures`` to the ``docker compose pull`` call when set to ``true`` (https://github.com/ansible-collections/community.docker/pull/1248).
|
||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace: community
|
namespace: community
|
||||||
name: docker
|
name: docker
|
||||||
version: 5.0.6
|
version: 5.1.0
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Ansible Docker Working Group
|
- Ansible Docker Working Group
|
||||||
|
|||||||
@ -51,6 +51,12 @@ options:
|
|||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
version_added: 3.12.0
|
version_added: 3.12.0
|
||||||
|
ignore_pull_failures:
|
||||||
|
description:
|
||||||
|
- If set to V(true), will pull what it can and ignores images with pull failures.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
version_added: 5.1.0
|
||||||
include_deps:
|
include_deps:
|
||||||
description:
|
description:
|
||||||
- If set to V(true), also pull services that are declared as dependencies.
|
- If set to V(true), also pull services that are declared as dependencies.
|
||||||
@ -132,6 +138,7 @@ class PullManager(BaseComposeManager):
|
|||||||
|
|
||||||
self.policy: t.Literal["always", "missing"] = parameters["policy"]
|
self.policy: t.Literal["always", "missing"] = parameters["policy"]
|
||||||
self.ignore_buildable: bool = parameters["ignore_buildable"]
|
self.ignore_buildable: bool = parameters["ignore_buildable"]
|
||||||
|
self.ignore_pull_failures: bool = parameters["ignore_pull_failures"]
|
||||||
self.include_deps: bool = parameters["include_deps"]
|
self.include_deps: bool = parameters["include_deps"]
|
||||||
self.services: list[str] = parameters["services"] or []
|
self.services: list[str] = parameters["services"] or []
|
||||||
|
|
||||||
@ -152,6 +159,8 @@ class PullManager(BaseComposeManager):
|
|||||||
args.extend(["--policy", self.policy])
|
args.extend(["--policy", self.policy])
|
||||||
if self.ignore_buildable:
|
if self.ignore_buildable:
|
||||||
args.append("--ignore-buildable")
|
args.append("--ignore-buildable")
|
||||||
|
if self.ignore_pull_failures:
|
||||||
|
args.append("--ignore-pull-failures")
|
||||||
if self.include_deps:
|
if self.include_deps:
|
||||||
args.append("--include-deps")
|
args.append("--include-deps")
|
||||||
if dry_run:
|
if dry_run:
|
||||||
@ -187,6 +196,7 @@ def main() -> None:
|
|||||||
"default": "always",
|
"default": "always",
|
||||||
},
|
},
|
||||||
"ignore_buildable": {"type": "bool", "default": False},
|
"ignore_buildable": {"type": "bool", "default": False},
|
||||||
|
"ignore_pull_failures": {"type": "bool", "default": False},
|
||||||
"include_deps": {"type": "bool", "default": False},
|
"include_deps": {"type": "bool", "default": False},
|
||||||
"services": {"type": "list", "elements": "str"},
|
"services": {"type": "list", "elements": "str"},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,6 +70,26 @@
|
|||||||
state: touch
|
state: touch
|
||||||
when: docker_skip_cleanup
|
when: docker_skip_cleanup
|
||||||
|
|
||||||
|
- name: Retrieve more information (0/4)
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: sh -c export
|
||||||
|
|
||||||
|
- name: Retrieve more information (1/4)
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: docker version
|
||||||
|
|
||||||
|
- name: Retrieve more information (2/4)
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: docker info
|
||||||
|
|
||||||
|
- name: Retrieve more information (3/4)
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: docker context ls
|
||||||
|
|
||||||
|
- name: Retrieve more information (4/4)
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: which docker
|
||||||
|
|
||||||
# Detect docker API version
|
# Detect docker API version
|
||||||
- name: Check Docker API version
|
- name: Check Docker API version
|
||||||
ansible.builtin.command: "docker version -f {% raw %}'{{(index .Server.Components 0).Details.ApiVersion}}'{% endraw %}"
|
ansible.builtin.command: "docker version -f {% raw %}'{{(index .Server.Components 0).Details.ApiVersion}}'{% endraw %}"
|
||||||
|
|||||||
@ -63,4 +63,8 @@
|
|||||||
{{ docker_cli_plugins_stdout.stdout | from_json | selectattr('Name', 'eq', 'compose') | map(attribute='Version') | first | default('0.0') | regex_replace('^v', '') }}
|
{{ docker_cli_plugins_stdout.stdout | from_json | selectattr('Name', 'eq', 'compose') | map(attribute='Version') | first | default('0.0') | regex_replace('^v', '') }}
|
||||||
|
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Has Docker compoes plugin: {{ docker_has_compose }}; Docker compose plugin version: {{ docker_compose_version }}"
|
msg: "Has Docker compose plugin: {{ docker_has_compose }}; Docker compose plugin version: {{ docker_compose_version }}"
|
||||||
|
|
||||||
|
- name: Retrieve more information
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: docker version
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user