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

github action unable to install requirements #3942

Open
veksh opened this issue Dec 12, 2023 · 3 comments
Open

github action unable to install requirements #3942

veksh opened this issue Dec 12, 2023 · 3 comments
Assignees
Labels

Comments

@veksh
Copy link

veksh commented Dec 12, 2023

Summary

Current github action (6.22.1) behaves as if it is always in "offline" mode (although according to logs it is not) and does not install requirements neigher from requirements.yml nor from galaxy.yml. This severely limites its usablilty, restricting it to mostly a YAML syntax check.

Issue Type
  • Bug Report
OS / ENVIRONMENT

github workflow

STEPS TO REPRODUCE

Test case is at https://github.com/veksh/ans-lint-test, it is like

  • playbook: simple aws s3 upload with the deliberate error in params, like
#...
  tasks:
    - name: Upload data to S3
      community.aws.s3_sync:
        region: "{{ region }}"
        bucket: "{{ bucket_name }}"
        file_root: "{{ data_path }}"
        delete: true
        # will not be detected
        deliberately_broken: true
      register: upload_result
  • requirements file to install aws collection
collections:
  - name: community.aws
    version: ">=7.0.0"
    type: galaxy
    source: https://galaxy.ansible.com
  • and github action in .github/workflows
# ...
jobs:
  lint:
    name: Ansible Lint
    runs-on: ubuntu-latest
    steps:
      - name: Check out repo
        uses: actions/checkout@v4
      - name: Run ansible-lint
        uses: ansible/ansible-lint@v6
        with:
          args: "-v"
  • optionally, .ansible-lint config with explicit offline: false
---
profile: production
offline: false
Desired Behavior

Flagged error in parameter

WARNING  Skipped installing collection dependencies due to running in offline mode.
WARNING  Listing 1 violation(s) that are fatal
args[module]: Unsupported parameters for (basic.py) module: deliberately_broken. Supported parameters include: access_key, aws_ca_bundle, aws_config, bucket, cache_control, debug_botocore_endpoint_logs, delete, endpoint_url, exclude, file_change_strategy, file_root, include, key_prefix, mime_map, mode, permission, profile, region, secret_key, session_token, storage_class, validate_certs (access_token, aws_access_key, aws_access_key_id, aws_endpoint_url, aws_profile, aws_region, aws_secret_access_key, aws_secret_key, aws_security_token, aws_session_token, ec2_access_key, ec2_region, ec2_secret_key, ec2_url, s3_url, security_token). (warning)

Local ansible-lint is also reporting that it will not install requirements

WARNING  Skipped installing collection dependencies due to running in offline mode.

but its ok because they are already installed

Actual Behavior

No errors, 3 warnings in logs (first is identical to a normal run of local ansible-lint)

WARNING  Skipped installing collection dependencies due to running in offline mode.
INFO     Executing syntax check on playbook upload.yaml (0.42s)
WARNING  Unable to load module community.aws.s3_sync at upload.yaml:13 for options validation
WARNING  Unable to resolve FQCN for module community.aws.s3_sync


@veksh veksh added bug new Triage required labels Dec 12, 2023
@konstruktoid
Copy link
Contributor

Related: #3607

@veksh
Copy link
Author

veksh commented Dec 12, 2023

In case of github action work-around is just to install ansible + lint from system packages (or pip) and run it.

jobs:
  lint:
    name: Ansible Lint
    runs-on: ubuntu-latest

    steps:
      - name: Check out repo
        uses: actions/checkout@v4

      - name: Run ansible-lint
        uses: ansible/ansible-lint@v6
        with:
          args: "-v --project-dir ."

      # - name: Install ansible-lint from system packages
      #   run: |
      #     sudo apt update
      #     sudo apt install ansible-core ansible-lint

      - name: Install ansible-lint with pip
        run: |
          sudo apt update
          sudo apt install pip git
          pip install ansible-core ansible-lint

      - name: Run ansible-lint on our repo
        run: |
          ansible-galaxy collection install -r requirements.yml
          ansible-lint -v -s --project-dir .

Same result, same time, any version could be used (attemt to use ansible/ansible-lint@v6.11.0 as an action fails), same way to configure lint (with config file). If action worked, I'd use it, but that's fine too

@audgirka audgirka removed the new Triage required label Dec 14, 2023
@konstruktoid
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Roadmap
Development

No branches or pull requests

5 participants