1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Add CI jobs and docs for podman_tag (#347)

This commit is contained in:
Sergey 2021-11-28 22:31:18 +02:00 committed by GitHub
parent f2882ecb19
commit 05515e8307
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 358 additions and 9 deletions

108
.github/workflows/podman_tag.yml vendored Normal file
View file

@ -0,0 +1,108 @@
name: Podman tag
on:
push:
paths:
- '.github/workflows/podman_tag.yml'
- 'ci/*.yml'
- 'ci/run_containers_tests.sh'
- 'ci/playbooks/containers/podman_tag.yml'
- 'plugins/modules/podman_tag.py'
- 'tests/integration/targets/podman_tag/**'
branches:
- master
pull_request:
paths:
- '.github/workflows/podman_tag.yml'
- 'ci/*.yml'
- 'ci/run_containers_tests.sh'
- 'ci/playbooks/containers/podman_tag.yml'
- 'plugins/modules/podman_tag.py'
- 'tests/integration/targets/podman_tag/**'
schedule:
- cron: 4 0 * * * # Run daily at 0:03 UTC
jobs:
test_podman_tag:
name: Podman tag ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-latest' }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ansible-version:
- ansible<2.10
# - git+https://github.com/ansible/ansible.git@stable-2.11
- git+https://github.com/ansible/ansible.git@devel
os:
- ubuntu-20.04
python-version:
- 3.9
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and display Python and PIP versions
run: |
sudo apt-get update
sudo apt-get install -y python*-wheel python*-yaml
python -m pip install --upgrade pip
python -V
pip --version
- name: Set up pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Ansible ${{ matrix.ansible-version }}
run: python3 -m pip install --user --force-reinstall --upgrade '${{ matrix.ansible-version }}'
- name: Build and install the collection tarball
run: |
rm -rf /tmp/just_new_collection
~/.local/bin/ansible-galaxy collection build --output-path /tmp/just_new_collection --force
~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz
- name: Run collection tests for podman tag
run: |
export PATH=~/.local/bin:$PATH
echo "Run ansible version"
command -v ansible
ansible --version
if [[ '${{ matrix.ansible-version }}' == 'git+https://github.com/ansible/ansible.git@devel' ]]; then
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg
elif [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then
export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg
fi
echo $ANSIBLE_CONFIG
command -v ansible-playbook
pip --version
python --version
ansible-playbook --version
ansible-playbook -vv ci/playbooks/pre.yml \
-e host=localhost \
-i localhost, \
-e ansible_connection=local \
-e setup_python=false
TEST2RUN=podman_tag ./ci/run_containers_tests.sh
shell: bash

View file

@ -0,0 +1,8 @@
---
- hosts: all
gather_facts: true
tasks:
- include_role:
name: podman_tag
vars:
ansible_python_interpreter: "{{ _ansible_python_interpreter }}"

View file

@ -68,6 +68,7 @@
<li><p><a class="reference internal" href="podman_pod_info_module.html#ansible-collections-containers-podman-podman-pod-info-module"><span class="std std-ref">podman_pod_info</span></a> Gather info about podman pods</p></li> <li><p><a class="reference internal" href="podman_pod_info_module.html#ansible-collections-containers-podman-podman-pod-info-module"><span class="std std-ref">podman_pod_info</span></a> Gather info about podman pods</p></li>
<li><p><a class="reference internal" href="podman_save_module.html#ansible-collections-containers-podman-podman-save-module"><span class="std std-ref">podman_save</span></a> Saves podman image to tar file</p></li> <li><p><a class="reference internal" href="podman_save_module.html#ansible-collections-containers-podman-podman-save-module"><span class="std std-ref">podman_save</span></a> Saves podman image to tar file</p></li>
<li><p><a class="reference internal" href="podman_secret_module.html#ansible-collections-containers-podman-podman-secret-module"><span class="std std-ref">podman_secret</span></a> Manage podman secrets</p></li> <li><p><a class="reference internal" href="podman_secret_module.html#ansible-collections-containers-podman-podman-secret-module"><span class="std std-ref">podman_secret</span></a> Manage podman secrets</p></li>
<li><p><a class="reference internal" href="podman_tag_module.html#ansible-collections-containers-podman-podman-tag-module"><span class="std std-ref">podman_tag</span></a> Add an additional name to a local image</p></li>
<li><p><a class="reference internal" href="podman_volume_module.html#ansible-collections-containers-podman-podman-volume-module"><span class="std std-ref">podman_volume</span></a> Manage Podman volumes</p></li> <li><p><a class="reference internal" href="podman_volume_module.html#ansible-collections-containers-podman-podman-volume-module"><span class="std std-ref">podman_volume</span></a> Manage Podman volumes</p></li>
<li><p><a class="reference internal" href="podman_volume_info_module.html#ansible-collections-containers-podman-podman-volume-info-module"><span class="std std-ref">podman_volume_info</span></a> Gather info about podman volumes</p></li> <li><p><a class="reference internal" href="podman_volume_info_module.html#ansible-collections-containers-podman-podman-volume-info-module"><span class="std std-ref">podman_volume_info</span></a> Gather info about podman volumes</p></li>
</ul> </ul>

Binary file not shown.

View file

@ -86,6 +86,36 @@
<td> <td>
<div>The value of the secret. Required when <code>state</code> is <code>present</code>.</div> <div>The value of the secret. Required when <code>state</code> is <code>present</code>.</div>
</td> </td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-driver"></div>
<b>driver</b>
<a class="ansibleOptionLink" href="#parameter-driver" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>Override default secrets driver, currently podman uses <code>file</code> which is unencrypted.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-driver_opts"></div>
<b>driver_opts</b>
<a class="ansibleOptionLink" href="#parameter-driver_opts" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">dictionary</span>
</div>
</td>
<td>
</td>
<td>
<div>Driver-specific key-value options.</div>
</td>
</tr> </tr>
<tr> <tr>
<td colspan="1"> <td colspan="1">

202
docs/podman_tag_module.html Normal file
View file

@ -0,0 +1,202 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>containers.podman.podman_tag Add an additional name to a local image &#8212; Python documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/antsibull-minimal.css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<span class="target" id="ansible-collections-containers-podman-podman-tag-module"></span><div class="section" id="containers-podman-podman-tag-add-an-additional-name-to-a-local-image">
<h1>containers.podman.podman_tag Add an additional name to a local image<a class="headerlink" href="#containers-podman-podman-tag-add-an-additional-name-to-a-local-image" title="Permalink to this headline"></a></h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This plugin is part of the <a class="reference external" href="https://galaxy.ansible.com/containers/podman">containers.podman collection</a> (version 1.8.3).</p>
<p>To install it use: <code class="code docutils literal notranslate"><span class="pre">ansible-galaxy</span> <span class="pre">collection</span> <span class="pre">install</span> <span class="pre">containers.podman</span></code>.</p>
<p>To use it in a playbook, specify: <code class="code docutils literal notranslate"><span class="pre">containers.podman.podman_tag</span></code>.</p>
</div>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#synopsis" id="id1">Synopsis</a></p></li>
<li><p><a class="reference internal" href="#requirements" id="id2">Requirements</a></p></li>
<li><p><a class="reference internal" href="#parameters" id="id3">Parameters</a></p></li>
<li><p><a class="reference internal" href="#examples" id="id4">Examples</a></p></li>
</ul>
</div>
<div class="section" id="synopsis">
<h2><a class="toc-backref" href="#id1">Synopsis</a><a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>podman tag adds one or more additional names to locally-stored image.</p></li>
</ul>
</div>
<div class="section" id="requirements">
<h2><a class="toc-backref" href="#id2">Requirements</a><a class="headerlink" href="#requirements" title="Permalink to this headline"></a></h2>
<p>The below requirements are needed on the host that executes this module.</p>
<ul class="simple">
<li><p>Podman installed on host</p></li>
</ul>
</div>
<div class="section" id="parameters">
<h2><a class="toc-backref" href="#id3">Parameters</a><a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<table border=0 cellpadding=0 class="documentation-table">
<tr>
<th colspan="1">Parameter</th>
<th>Choices/<font color="blue">Defaults</font></th>
<th width="100%">Comments</th>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-executable"></div>
<b>executable</b>
<a class="ansibleOptionLink" href="#parameter-executable" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">"podman"</div>
</td>
<td>
<div>Path to <code>podman</code> executable if it is not in the <code>$PATH</code> on the machine running <code>podman</code></div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-image"></div>
<b>image</b>
<a class="ansibleOptionLink" href="#parameter-image" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
/ <span style="color: red">required</span> </div>
</td>
<td>
</td>
<td>
<div>Image to tag.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-target_names"></div>
<b>target_names</b>
<a class="ansibleOptionLink" href="#parameter-target_names" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
/ <span style="color: purple">elements=string</span> / <span style="color: red">required</span> </div>
</td>
<td>
</td>
<td>
<div>Additional names.</div>
</td>
</tr>
</table>
<br/></div>
<div class="section" id="examples">
<h2><a class="toc-backref" href="#id4">Examples</a><a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-yaml+jinja notranslate"><div class="highlight"><pre><span></span><span class="c1"># What modules does for example</span>
<span class="p p-Indicator">-</span> <span class="nt">containers.podman.podman_tag</span><span class="p">:</span>
<span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">docker.io/continuumio/miniconda3</span>
<span class="nt">target_names</span><span class="p">:</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">miniconda3</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">miniconda</span>
</pre></div>
</div>
<div class="section" id="authors">
<h3>Authors<a class="headerlink" href="#authors" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Christian Bourque (&#64;ocafebabe)</p></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">Python</a></h1>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 3.3.1</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/podman_tag_module.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# coding: utf-8 -*- # coding: utf-8 -*-
# Copyright (c) 2021, Sagi Shnaidman <sshnaidm@redhat.com> # Copyright (c) 2021, Christian Bourque <@ocafebabe>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View file

@ -3,25 +3,25 @@
block: block:
- name: Pull image - name: Pull image
containers.podman.podman_image: containers.podman.podman_image:
name: docker.io/library/openjdk:8-jdk-alpine name: docker.io/library/alpine
- name: Tag image - name: Tag image
containers.podman.podman_tag: containers.podman.podman_tag:
image: docker.io/library/openjdk:8-jdk-alpine image: docker.io/library/alpine
target_names: target_names:
- openjdk8 - openjdk8
- jdk8 - jdk8
- name: Get tagged image info - name: Get tagged image info
containers.podman.podman_image_info: containers.podman.podman_image_info:
name: docker.io/library/openjdk:8-jdk-alpine name: docker.io/library/alpine
register: tagged_image_result register: tagged_image_result
- name: Check results - name: Check results
assert: assert:
that: that:
- tagged_image_result.images | length == 1 - tagged_image_result.images | length == 1
- "'docker.io/library/openjdk:8-jdk-alpine' in tagged_image_result.images[0]['RepoTags'][0]" - "'docker.io/library/alpine' in tagged_image_result.images[0]['RepoTags'][0]"
- "'localhost/openjdk8:latest' in tagged_image_result.images[0]['RepoTags'][1]" - "'localhost/openjdk8:latest' in tagged_image_result.images[0]['RepoTags'][1]"
- "'localhost/jdk8:latest' in tagged_image_result.images[0]['RepoTags'][2]" - "'localhost/jdk8:latest' in tagged_image_result.images[0]['RepoTags'][2]"
@ -31,6 +31,6 @@
name: "{{ item }}" name: "{{ item }}"
state: absent state: absent
loop: loop:
- docker.io/library/openjdk:8-jdk-alpine - docker.io/library/alpine
- localhost/openjdk8 - localhost/openjdk8
- localhost/jdk8 - localhost/jdk8