From b4e1802a66ccc41ffd0d4532ccdb9449aa18740e Mon Sep 17 00:00:00 2001 From: Saul Wold Date: Mon, 7 Oct 2019 09:53:31 -0700 Subject: [PATCH] Update ansible job Since we are now storing the _service in OBS, use it instead of constructing the file. Clean-up the unused code. Initial testing with fault, more to come. Story: 2006673 Task: 36943 Change-Id: Ic9cd73ee31d213550263b415670b0bcae8953236 Signed-off-by: Saul Wold --- playbooks/buildproject.yaml | 21 ++--------- roles/osc/tasks/detachbranch.yaml | 59 ++++++------------------------- roles/osc/tasks/linkpackage.yaml | 10 ++++++ roles/osc/templates/_service.j2 | 16 --------- 4 files changed, 22 insertions(+), 84 deletions(-) create mode 100644 roles/osc/tasks/linkpackage.yaml delete mode 100644 roles/osc/templates/_service.j2 diff --git a/playbooks/buildproject.yaml b/playbooks/buildproject.yaml index 237ac85..980fd43 100644 --- a/playbooks/buildproject.yaml +++ b/playbooks/buildproject.yaml @@ -115,8 +115,6 @@ - debug: msg: "{{ repo_name }}: {{ repo_dir }} " - - meta: end_play - - name: List spec files debug: msg: "Specfile List: {{ specfiles }}" @@ -135,31 +133,16 @@ msg: "Sorted Directories: {{ item }}" with_items: "{{ sorted_dirs }}" - - name: OSC mkpac + - name: OSC Link Package import_role: name: osc - tasks_from: mkpac + tasks_from: linkpackage - name: OSC detachbranch import_role: name: osc tasks_from: detachbranch - - name: Create Service file - include_role: - name: osc - tasks_from: create_service - vars: - package_dir_orig: "{{ package_name }}/{{ lookup('ini', 'SRC_DIR type=properties file=/fault/' + package_name + '/centos/build_srpm.data') | regex_replace('\"', '') | regex_replace('\\/\\.', '') }}" - with_items: "{{ sorted_dirs }}" - loop_control: - loop_var: package_name - - - name: OSC commit - import_role: - name: osc - tasks_from: commit - # pushd ./out # sleep 5 # # Check if there is no change, then pretent success diff --git a/roles/osc/tasks/detachbranch.yaml b/roles/osc/tasks/detachbranch.yaml index 5fb27d8..68e4b41 100644 --- a/roles/osc/tasks/detachbranch.yaml +++ b/roles/osc/tasks/detachbranch.yaml @@ -1,51 +1,12 @@ --- -# Create the _meta template file -#- name: OSC detachbranch -# command: "osc detachbranch {{ test_project }} {{ item }}" -# args: -# chdir: "{{ stx_pkg_tmpdir.path }}" -# with_items: "{{ sorted_dirs }}" -#- name: Remove directory -# file: -# path: "{{ stx_pkg_tmpdir.path }}/{{ item }}" -# state: absent -# with_items: "{{ sorted_dirs }}" -#- name: OSC Checkout -# command: "osc checkout {{ item }}" -# args: -# chdir: "{{ stx_pkg_tmpdir.path }}" -# with_items: "{{ sorted_dirs }}" -- name: Restore meta-data - shell: cp {{ src_dir }}/{{ item }}/{{ target_distro }}/*[.cpst]* {{ stx_pkg_tmpdir.path }}/{{ item }} +- name: OSC Checkout + command: "osc checkout {{ item }}" + args: + chdir: "{{ stx_pkg_tmpdir.path }}" + with_items: "{{ sorted_dirs }}" + +- name: Detach branch + command: "osc detachbranch" + args: + chdir: "{{ stx_pkg_tmpdir.path }}/{{ item }}" with_items: "{{ sorted_dirs }}" -#- name: OSC AddRemove -# command: "osc addremove" -# args: -# chdir: "{{ stx_pkg_tmpdir.path }}/{{ item }}" -# with_items: "{{ sorted_dirs }}" -#- name: OSC Commit -# command: "osc commit" -# args: -# chdir: "{{ stx_pkg_tmpdir.path }}/{{ item }}" -# with_items: "{{ sorted_dirs }}" - # - #def osc_detachbranch(workdir, project, pkgname): - # olddir = os.getcwd() - # try: - # os.chdir(os.path.join(workdir)) - # sh.osc('detachbranch', project, pkgname) - # os.mkdir(pkgname + '.b') - # for f in glob.glob(os.path.join(pkgname, '*')): - # os.rename(f, os.path.join(pkgname + '.b', os.path.basename(f))) - # sh.rm('-rf', pkgname) - # sh.osc('co', pkgname) - # for f in glob.glob(os.path.join(pkgname + '.b', '*')): - # dst = os.path.basename(f) - # try: - # os.unlink(os.path.join(pkgname, dst)) - # except OSError: - # pass - # os.rename(f, os.path.join(pkgname, dst)) - # os.rmdir(pkgname + '.b') - # finally: - # os.chdir(olddir) diff --git a/roles/osc/tasks/linkpackage.yaml b/roles/osc/tasks/linkpackage.yaml new file mode 100644 index 0000000..f62653e --- /dev/null +++ b/roles/osc/tasks/linkpackage.yaml @@ -0,0 +1,10 @@ +--- +# Create the _meta template file +- name: OSC Link Packages + command: "osc linkpac {{ src_project }} {{ item }} {{ target_project }}-1.0" + args: + chdir: "{{ stx_pkg_tmpdir.path }}" + with_items: "{{ sorted_dirs }}" + #- name: Copy meta-data + #shell: ls -la {{ top_dir }}/save/{{ item }}/*.[cstp]* {{ stx_pkg_tmpdir.path }}/{{ item }} >> /tmp/list; cp {{ top_dir }}/save/{{ item }}/*.[cstp]* {{ stx_pkg_tmpdir.path }}/{{ item }} + #with_items: "{{ sorted_dirs }}" diff --git a/roles/osc/templates/_service.j2 b/roles/osc/templates/_service.j2 deleted file mode 100644 index cf90b38..0000000 --- a/roles/osc/templates/_service.j2 +++ /dev/null @@ -1,16 +0,0 @@ - - - git - https://opendev.org/starlingx/fault - 1.0 - {{ package_dir }} - {{ package_name }} - disable - - - gz - *.tar - - - -