Git Product home page Git Product logo

docker-github-action-molecule's Introduction

docker-github-action-molecule

A container that is used for GitHub actions molecule.

github-action-molecule build status

This container contains:

  • ansible - Used to run the tests.
  • ansible-lint - A command-line tool for linting playbooks, roles and collections aimed towards any Ansible users.
  • docker - Used by molecule to start instances using the docker driver.
  • molecule - Used to orchestrate the tests. molecule-plugins are installed too.
  • tox - Used to test multiple version of ansible if tox.ini exists.
  • testinfra - Used to test the instances.
  • yamllint - Used to lint YAML files.
  • rsync, required in same cases for Molecule.
  • Linux tools like docker, gcc, git (core), python3-* and rsync are installed too.

The default behaviour is to:

  • See if tox.ini exists -> Run tox
  • Otherwise -> Run molecule test
  • Retry either (tox or molecule) 3 times.
  • Run test if command is not set.
  • Test the default scenario if scenario in not set.

Read how to test locally.

robertdebock

Please consider sponsoring me.

docker-github-action-molecule's People

Contributors

dale-c-anderson avatar dependabot[bot] avatar melkor333 avatar robert-de-bock avatar robertdebock avatar stefangweichinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-github-action-molecule's Issues

Run multiple molecule scenarios

Hi,

it seems the action doesn't run all scenarios:
https://github.com/hostwithquantum/ansible-loki/pull/4/checks?check_run_id=860713499

It seems to run default, but not the update scenario.

Is there a way to do a molecule test --all without something like tox? I am not keen on adding another thing. I couldn't figure out how to add parameters to molecule otherwise. Any pointers? I am happy to add the action multiple times too, so I can run the tests in parallel easily.

Till

Some images dont contain Python

I am using your awesome action to test my roles. I created a very simple role that has a local action. However, a number of the images fail because python is not installed.

fatal: [generate-ssh-keys-alpine-latestpy310-ansible-4]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "/bin/sh: /usr/bin/python: not found\n", "module_stdout": "", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127}

This failed on OpenSUSE, Alpine and Debian images. Please could you add the python package to these images.

Thank you

What's the point of multiple attempts in the retry loop?

Our use case is such that we want molecule to fail the first time when there is a problem. We don't want to reproduce the exact same failure 2 more times before the action stops. Doing so seems a waste of Github's compute resources, especially when testing against large strategy matrices.

Can

if [ $counter -ge 3 ] ;

be changed to accept an environment variable? E.g.

if [ $counter -ge ${max_failures:-3} ] ;

? I'd be happy to submit a PR.

molecule failures do not result in a broken build

For example this test shows that molecule fails, but GitHub Actions mentions: "This check passed".

Likely relates to the break logic.

The exact command used:

 /usr/bin/docker run --name robertdebockgithubactionmolecule105_f2ef3d --label 488dfb --workdir /github/workspace --rm -e TOX_PARALLEL_NO_SPINNER -e INPUT_IMAGE -e INPUT_TAG -e INPUT_OPTIONS -e INPUT_NAMESPACE -e namespace -e image -e tag -e options -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/ansible-role-virtualbox/ansible-role-virtualbox":"/github/workspace" robertdebock/github-action-molecule:1.0.5

Missing Dependency `rsync`

hey Rob! :)

I'm trying to use this github action for molecule tests in an ansible collection. But apparently it doesn't work with "remote" images which it wants to fetch with rsync.

Is it possible to install rsync in the action container to circumvent this problem?

Edit: Forgot to add the link the the non-working action (if it for some reason github doesn't jump to the proper line, it's the lines 191-195)

errors using molecule-action v5

(I'm new to making ansible roles AND GitHub actions, so bear with me!)

In my ansible-timezone fork I'm trying to use molecule-action to test. With v5 it fails running molecule missing a parameter, it seems.

In my last test I setup the job so it runs lint with v4 (works) and test with v5 (fails).

Usage: molecule [OPTIONS] COMMAND [ARGS]...
Try 'molecule --help' for help.

Error: No such option: --debug test (Possible options: --debug, --no-debug)
ACTION: Retry attempt 1.
Usage: molecule [OPTIONS] COMMAND [ARGS]...
Try 'molecule --help' for help.

Example action run: https://github.com/abh/ansible-timezone/actions/runs/5152456387/jobs/9278594310

workflow file

Also pasted here:

---
name: GitHub Action

on:
  push:
    branches:
      - main
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+"

jobs:
  lint:
    runs-on: ubuntu-22.04
    steps:
      - name: checkout
        uses: actions/checkout@v3
        with:
          path: "${{ github.repository }}"
      - name: molecule
        # https://github.com/marketplace/actions/test-ansible-roles-with-molecule
        uses: robertdebock/[email protected]
        with:
          command: lint

  test:
    needs:
      - lint 
    runs-on: ubuntu-20.04
    steps:
      - name: checkout
        uses: actions/checkout@v3
        with:
          path: "${{ github.repository }}"
      - name: molecule
        uses: robertdebock/[email protected]
        with:
          command: "--debug test"

  release:
    needs:
      - test
    runs-on: ubuntu-latest
    if: startsWith(github.event.ref, 'refs/tags/v')
    steps:
      - name: checkout
        uses: actions/checkout@v3
      - name: galaxy
        # https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
        uses: robertdebock/[email protected]
        with:
          galaxy_api_key: ${{ secrets.galaxy_api_key }}
          git_branch: main

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.