Browse Source

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 <sgw@linux.intel.com>
tags/v3.0.0.rc0
Saul Wold 4 months ago
parent
commit
b4e1802a66
4 changed files with 22 additions and 84 deletions
  1. +2
    -19
      playbooks/buildproject.yaml
  2. +10
    -49
      roles/osc/tasks/detachbranch.yaml
  3. +10
    -0
      roles/osc/tasks/linkpackage.yaml
  4. +0
    -16
      roles/osc/templates/_service.j2

+ 2
- 19
playbooks/buildproject.yaml View File

@@ -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

+ 10
- 49
roles/osc/tasks/detachbranch.yaml View File

@@ -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)

+ 10
- 0
roles/osc/tasks/linkpackage.yaml View File

@@ -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 }}"

+ 0
- 16
roles/osc/templates/_service.j2 View File

@@ -1,16 +0,0 @@
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://opendev.org/starlingx/fault</param>
<param name="version">1.0</param>
<param name="subdir">{{ package_dir }}</param>
<param name="filename">{{ package_name }}</param>
<param name="changesgenerate">disable</param>
</service>
<service name="recompress">
<param name="compression">gz</param>
<param name="file">*.tar</param>
</service>
<service name="set_version" mode="disabled"/>
</services>


Loading…
Cancel
Save