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

validate-architecture: empty ANSIBLE_OPTS by default #1743

Conversation

queria
Copy link
Contributor

@queria queria commented May 22, 2024

ANSIBLE_OPTS extra parameter is passed as extra quoted from
run_ctx_architecture_test into nested architecture_test_nodeps target,
before it gets passed to ansible-playbook invocation.

But its current default value set to '' gets rendered when nesting
into contaier as "''" resulting in failure:

      make -e SCENARIO_NAME="hci" \
        -e ARCH_REPO=/var/home/psedlak/all/src/architecture \
        -e INSTALL_YAMLS_REPO=/var/home/psedlak/all/src/install_yamls \
        -e NET_ENV_FILE=$(readlink -f .)/ci/playbooks/files/networking-env-definition.yml \
        run_ctx_architecture_test
      ...
      podman unshare chown 1000:1000 "/var/home/psedlak/ci-framework-data/validate-hci";
      podman run --rm --security-opt label=disable -v .:/opt/sources \
              -e HOME=/tmp \
              -e ANSIBLE_LOCAL_TMP=/tmp \
              -e ANSIBLE_REMOTE_TMP=/tmp \
              -e SCENARIO_NAME=hci \
              -e ARCH_REPO=/architecture \
              -e NET_ENV_FILE=/net-env-file.yml \
              -v /var/home/psedlak/all/src/architecture:/architecture:ro \
              -v /var/home/psedlak/all/src/ci-framework/ci/playbooks/files/networking-env-definition.yml:/net-env-file.yml:ro \
              -v "/var/home/psedlak/ci-framework-data/validate-hci":/tmp/ci-framework-data:rw \
              localhost/cifmw:latest bash -c \
              "make architecture_test_nodeps ANSIBLE_OPTS=\"''\""; \

      ...
      ansible-playbook -i localhost, -c local \
              ci/playbooks/validate-architecture.yml \
              -e cifmw_zuul_target_host=localhost \
              -e ansible_user_dir=/tmp \
              -e cifmw_architecture_repo=/tmp/local-arch-repo \
              -e cifmw_architecture_scenario=hci \
              -e cifmw_networking_mapper_networking_env_def_path=/net-env-file.yml \
              ''
      usage: ansible-playbook [-h] [--version] [-v] [--private-key PRIVATE_KEY_FILE]
      ...
      ansible-playbook: error: unrecognized arguments:

To get the passing execution, one needs to explicitely set the variable
to empty like: make -e ANSIBLE_OPTS= -e ....

Setting the variable to just empty/nothing as default fixes the issue.

As a pull request owner and reviewers, I checked that:

  • there's no test for that makefile target (yet?)

Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/ci-framework for 1743,cc93174be06224dca56f61e2fc8147e4d0b3ec31

@github-actions github-actions bot marked this pull request as draft May 22, 2024 10:08
Copy link

Thanks for the PR! ❤️
I'm marking it as a draft, once your happy with it merging and the PR is passing CI, click the "Ready for review" button below.

ANSIBLE_OPTS extra parameter is passed as extra quoted from
`run_ctx_architecture_test` into nested `architecture_test_nodeps` target,
before it gets passed to ansible-playbook invocation.

But its current default value set to `''` gets rendered when nesting
into contaier as `"''"` resulting in failure:

  make -e SCENARIO_NAME="hci" \
    -e ARCH_REPO=/var/home/psedlak/all/src/architecture \
    -e INSTALL_YAMLS_REPO=/var/home/psedlak/all/src/install_yamls \
    -e NET_ENV_FILE=$(readlink -f .)/ci/playbooks/files/networking-env-definition.yml \
    run_ctx_architecture_test
  ...
  podman unshare chown 1000:1000 "/var/home/psedlak/ci-framework-data/validate-hci";
  podman run --rm --security-opt label=disable -v .:/opt/sources \
          -e HOME=/tmp \
          -e ANSIBLE_LOCAL_TMP=/tmp \
          -e ANSIBLE_REMOTE_TMP=/tmp \
          -e SCENARIO_NAME=hci \
          -e ARCH_REPO=/architecture \
          -e NET_ENV_FILE=/net-env-file.yml \
          -v /var/home/psedlak/all/src/architecture:/architecture:ro \
          -v /var/home/psedlak/all/src/ci-framework/ci/playbooks/files/networking-env-definition.yml:/net-env-file.yml:ro \
          -v "/var/home/psedlak/ci-framework-data/validate-hci":/tmp/ci-framework-data:rw \
          localhost/cifmw:latest bash -c \
          "make architecture_test_nodeps ANSIBLE_OPTS=\"''\""; \

  ...
  ansible-playbook -i localhost, -c local \
          ci/playbooks/validate-architecture.yml \
          -e cifmw_zuul_target_host=localhost \
          -e ansible_user_dir=/tmp \
          -e cifmw_architecture_repo=/tmp/local-arch-repo \
          -e cifmw_architecture_scenario=hci \
          -e cifmw_networking_mapper_networking_env_def_path=/net-env-file.yml \
          ''
  usage: ansible-playbook [-h] [--version] [-v] [--private-key PRIVATE_KEY_FILE]
  ...
  ansible-playbook: error: unrecognized arguments:

To get the passing execution, one needs to explicitely set the variable
to empty like: `make -e ANSIBLE_OPTS= -e ...`.

Setting the variable to just empty/nothing as default fixes the issue.
@queria queria force-pushed the architecture-validate-empty-opts branch from cc93174 to 5e8c822 Compare May 22, 2024 10:49
@queria queria marked this pull request as ready for review May 22, 2024 10:50
@openshift-ci openshift-ci bot requested a review from bshewale May 22, 2024 10:50
@cjeanner
Copy link
Contributor

/approve

fun I didn't hit that one - but maybe I didn't test without any ANSIBLE_OPTS, can't say, doing too many things in parallel :/

Copy link
Contributor

openshift-ci bot commented May 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjeanner

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rlandy
Copy link
Collaborator

rlandy commented May 22, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label May 22, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 23dffe6 into openstack-k8s-operators:main May 22, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants