-
Notifications
You must be signed in to change notification settings - Fork 4
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
Re-implement acts as Ansible playbooks #35
Comments
---
product: Fedora
distribution: f27
build: etcd-3.2.7-1.fc27
rpms:
- etcd-3.2.7-1.fc27.src.rpm
- etcd-3.2.7-1.fc27.aarch64.rpm
- etcd-unit-test-3.2.7-1.fc27.aarch64.rpm
- etcd-debuginfo-3.2.7-1.fc27.aarch64.rpm
- etcd-debugsource-3.2.7-1.fc27.aarch64.rpm
srpm: etcd-3.2.7-1.fc27.src.rpm
# Parse src rpm first
- name: Check if ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_PACKAGES is already processed
artefactreader:
key:
artefact: ARTEFACT_GOLANG_PROJECT_INFO_FEDORA
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
rpm: "{{ srpm }}"
register: srpm_check
- when: srpm_check.exists
srpminfo: "{{ srpm_check.artefact }}"
- when: not srpm_check.exists
block:
- name: Retrieve srpm build
rpmretriever:
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
rpm: "{{ srpm }}"
register: srpminfo
- name: Extract data from rpm
specdataextractor:
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
srpm: "{{ srpm }}"
directory: srpminfo.directory
register: srpmartefacts
- name: Store rpm artefacts
artefactwriter:
artefact: "{{ srpmartefacts[ARTEFACT_GOLANG_PROJECT_INFO_FEDORA] }}"
# rpm expected as a json {"name": ..., "arch": ...}
- with_items: "{{ rpms }}"
when: item.name | select("endswith", "devel.rpm")
# Loop through all rpms
block:
- name: Check if ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_PACKAGES is already processed
artefactreader:
key:
artefact: ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_PACKAGES
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
rpm: "{{ rpm_item }}"
register: packages_checks
- name: Check if ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_EXPORTED_API is already processed
artefactreader:
key:
artefact: ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_EXPORTED_API
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
rpm: "{{ rpm_item }}"
register: api_checks
- when: not packages_checks.exists || not api_checks.exists
block:
- name: Retrieve rpm build
rpmretriever:
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
rpm: "{{ rpm_item }}"
register: rpminfo
- name: Extract data from rpm
distributiongosymbolsextractor:
product: "{{ product }}"
distribution: "{{ distribution }}"
build: "{{ build }}"
rpm: "{{ rpm_item }}"
directory: rpminfo.directory
register: rpmartefacts
- name: Create ipprefix2rpm mapping
ipprefix2rpmmapper:
golangprojectdistributionpackages: "{{ rpmartefacts[ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_PACKAGES] }}"
golangprojectinfofedora: "{{ srpmartefacts[ARTEFACT_GOLANG_PROJECT_INFO_FEDORA] }}"
register: ipp2rpm
- name: Store rpm artefacts
artefactwriter:
artefact: "{{ item }}"
with_items:
- rpmartefacts[ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_PACKAGES]
- rpmartefacts[ARTEFACT_GOLANG_PROJECT_DISTRIBUTION_EXPORTED_API]
- ipp2rpm.artefact |
@jcajka FYI |
Following Ansible modules will be required:
So we just combine I/O of Ansible modules/plugins together. This was the original idea: combine black boxes on a declarative level so noone has to be familiar with the underlying infrastructure. Given the nature of the Ansible, it is the perfect DSL candidate. Most of the code is already implemented in the existing infrastructure. So it should be more or less copy-pasta and some minimal coding. |
@fridex in case you are bored :) |
There are more complex acts (e.g. |
So far it looks awesome (https://github.com/gofed/infra/tree/migrate-to-ansible/ansible): ---
- name: Go code inspection act
connection: local
hosts: localhost
roles:
- role: gofedinfra
tasks:
- name: Retrieve source code from a repository
repositorycoderetriever:
repository: github.com/coreos/etcd/cmd/etcdctl
hexsha: 121edf0467052d55876a817b89875fb39a99bf78
register: output
- debug: var=output
- name: Extract artefacts from a Go code
gosymbolsextractor:
directory: "{{ output.directory }}"
repository: github.com/coreos/etcd
hexsha: 121edf0467052d55876a817b89875fb39a99bf78
ipprefix: github.com/coreos/etcd
register: eoutput
- name: Remove working directory
file:
name: "{{ output.directory }}"
state: absent now just add artefact reader/writter and it's done. |
Layout the playbooks in the following manner: language/category/jobname.yml E.g.
|
Correspondence:
Plugins are currently implemented as python modules so it should be pretty straightforward to wrap them as Ansible modules. The data exchanged between plugins are JSON based. The same can be used in the playbooks.
Then:
The text was updated successfully, but these errors were encountered: