owned this note changed 5 years ago
Linked with GitHub

get-hash consolidation

MOVED TO: https://hackmd.io/9ZezLZshR2OE65JD9YcjYg

Repository Code src Usage Where
openstack/tripleo-ci roles/build-containers Retrieve the hash to build containers container build jobs (check/periodic)
openstack/tripleo-ci emit_releases_file.py
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
openstack/tripleo-quickstart roles/repo-setup retrieve hash to set repo up
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
rdo-infra/ci-config roles/get-hash get hash for component/integration pipelines centos8 & component jobs
rdo-infra/review.rdoproject.org-config get-hash.sh old/deprecated get-hash script (must be) replaced by get-hash role in ci-config
rdo-infra/ci-config promoter code promoter bits that get dlrn hash? promoter code

PROBLEMS

Duplicated code

There are many different get-hash code functions spread across tripleo projects/repos w/ their respective unique ways of getting the hash from dlrn api. All these bits must be consolidated in one single code.

Bash code

Some bits in bash are hard to test, or even untestable.

Deprecated / old code

Some of these methods are no longer used and should be removed from the code base.

SOLUTION

Once you get dlrnapi_client installed in the virtualenv, you can use dlrn_api ansible module like in the example here. You may also import the python module dlrnapi_client, which comes from the same pip packages installed.

Tested example:

- name: check reported results
  hosts: localhost
  vars:
    dlrnapi_user: <obfuscated>
    dlrnapi_pass: <obfuscated>
    dlrn_server_url: https://trunk.rdoproject.org/api-centos8-master-uc
    get_hash:
      commit_hash: 364d07fa857eb87caa6717f4d063dc84e5e2842a
      distro_hash: f6f9a73b2565b441813c54aa1e44730f9bde9c2e
  tasks:

    - pip:
        name: dlrnapi_client

    - command: "{{ ansible_python_interpreter }} -c 'import dlrnapi_client'"

    - dlrn_api:
        action: repo-status
        host: "{{ dlrn_server_url }}"
        user: "{{ dlrnapi_user }}"
        password: "{{ dlrnapi_pass }}"
        job_id: "{{ item }}"
        commit_hash: "{{ get_hash.commit_hash }}"
        distro_hash: "{{ get_hash.distro_hash }}"
        success: true
        notes: 'Tested from ansible'
      register: dlrnout
      with_items:
        - periodic-tripleo-ci-centos-8-standalone
    - debug:
        var: dlrnout

Note: This works pretty well on py3

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Collateral fixes

The bits that interact with dlrn api (like check_dlrn_reports task and promote-hash role) are written in bash and should be replaced w/ python/ansible modules. These are not directly related to get-hash code.

check dlrn reports

Even w/ the new role, the code that interacts w/ dlrnapi is a bash script. And it sources files w/ env vars. This is how hash_info files are created and sourced in the get-hash role.

promote hash

Another piece of code that is in bash and must be converted to ansible is the promote-hash role in config repo.

Select a repo