Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(containers): add labels to AVD container images and fork test workflows #5081

Open
wants to merge 15 commits into
base: devel
Choose a base branch
from

Conversation

ankudinov
Copy link
Contributor

Change Summary

This PR adds following:

  1. Workflow to test container builds on fork. The new workflows will never run on the main repo and require DEBUG_CONTAINER_ACTIONS="true" env variable to be set.
  2. We'll add some labels to container images. As a starting point I'm considering com.arista.license_terms a limited number of OCI labels:
  • org.opencontainers.image.authors
  • org.opencontainers.image.created
  • org.opencontainers.image.description
  • org.opencontainers.image.documentation
  • org.opencontainers.image.licenses
  • org.opencontainers.image.source
  • org.opencontainers.image.url
  • org.opencontainers.image.vendor
  • org.opencontainers.image.version

org.opencontainers.image.description is likely the most critical as it can provide arbitrary instructions, including prod/preview status of the container.

Copy link

Review docs on Read the Docs

To test this pull request:

# Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-5081
# Activate the virtual environment
source test-avd-pr-5081/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/ankudinov/avd.git@container_labels#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/ankudinov/avd.git#/ansible_collections/arista/avd/,container_labels --force
# Optional: Install AVD examples
cd test-avd-pr-5081
ansible-playbook arista.avd.install_examples

@github-actions github-actions bot added the type: code quality CI and development toolset label Feb 20, 2025
@ankudinov
Copy link
Contributor Author

The new workflows were created to add some flexibility and due to the fact that I can't make branches: [ '**' ] conditional in any other way. However this adds some code duplication and any changes in test workflow must be replicated on the main one once stable. Alternative suggestions welcome!

How to test:

  • fork
  • wait for container image build to finish
  • pull and inspect any image and check labels

Alternatively simply review the code and run:

podman pull ghcr.io/ankudinov/avd/universal:python3.11-avd-container_labels
podman inspect ghcr.io/ankudinov/avd/universal:python3.11-avd-container_labels

@ankudinov ankudinov marked this pull request as ready for review February 21, 2025 10:04
@ankudinov ankudinov requested review from a team as code owners February 21, 2025 10:04

"on":
push:
branches: [ '**' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed at all.

Suggested change
branches: [ '**' ]

- .github/workflows/container_build_template.yml
- .github/workflows/build_base_on_forks.yml
workflow_dispatch:
branches: [ '**' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches: [ '**' ]


"on":
push:
branches: [ '**' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches: [ '**' ]


"on":
push:
branches: [ '**' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches: [ '**' ]

- .github/workflows/container_build_template.yml
- .github/workflows/build_dev_on_forks.yml
workflow_dispatch:
branches: [ '**' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches: [ '**' ]

- .github/workflows/build_universal_on_forks.yml
- ansible_collections/arista/avd/**
workflow_dispatch:
branches: [ '**' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches: [ '**' ]


jobs:
build_universal_container:
if: github.repository != 'aristanetworks/avd' && ${{ vars.DEBUG_CONTAINER_ACTIONS }} == "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where will these containers be uploaded to? It should be the PR repo and not ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code quality CI and development toolset
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants