diff options
Diffstat (limited to 'ldcg-python-manylinux-tensorflow/ansible/roles/tensorflow/tasks/fetch.yml')
-rw-r--r-- | ldcg-python-manylinux-tensorflow/ansible/roles/tensorflow/tasks/fetch.yml | 117 |
1 files changed, 73 insertions, 44 deletions
diff --git a/ldcg-python-manylinux-tensorflow/ansible/roles/tensorflow/tasks/fetch.yml b/ldcg-python-manylinux-tensorflow/ansible/roles/tensorflow/tasks/fetch.yml index 4508a510c5..6ea0e8bf76 100644 --- a/ldcg-python-manylinux-tensorflow/ansible/roles/tensorflow/tasks/fetch.yml +++ b/ldcg-python-manylinux-tensorflow/ansible/roles/tensorflow/tasks/fetch.yml @@ -1,45 +1,74 @@ -- block: - - name: fetch tensorflow {{ tensorflow_version }} source - get_url: - url: "https://github.com/tensorflow/tensorflow/archive/v{{ tensorflow_version }}.tar.gz" - dest: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}.tar.gz" - mode: 0600 - - - name: unpack tensorflow {{ tensorflow_version }} source - unarchive: - src: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}.tar.gz" - dest: "{{ build_dir }}/" - remote_src: true - - - name: copy configure script - copy: - src: "files/configure_tensorflow" - dest: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}/configure_tensorflow" - mode: 0400 - - - name: drop Python 2.7 deps - lineinfile: - regexp: "^.*'{{ item }} >=.*$" - state: absent - path: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}/tensorflow/tools/pip_package/setup.py" - loop: - - "functools32" - - "enum34" - - "backports.weakref" - when: tensorflow_version != 'git' - -- block: - - name: fetch tensorflow from git - git: - repo: "https://github.com/tensorflow/tensorflow.git" # noqa 401 - dest: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}/" - depth: 1 - recursive: true - force: true - - - name: copy configure script - copy: - src: "files/configure_tensorflow-git" - dest: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}/configure_tensorflow" - mode: 0400 +--- +- name: Fetch TensorFlow source archive + when: tensorflow_version != 'git' and not prebuild_release + block: + - name: Fetch TensorFlow{{ variant_name }} {{ tensorflow_version }} source + ansible.builtin.get_url: + url: "https://github.com/tensorflow/tensorflow/archive/v{{ tensorflow_version }}.tar.gz" + dest: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}.tar.gz" + mode: 0600 + + - name: Unpack TensorFlow{{ variant_name }} {{ tensorflow_version }} source + ansible.builtin.unarchive: + src: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}.tar.gz" + dest: "{{ build_dir }}/" + remote_src: true + + - name: Rename source dir for oneDNN build + ansible.builtin.command: "mv {{ build_dir }}/tensorflow-{{ tensorflow_version }} {{ tensorflow_build_dir }}" + args: + creates: "{{ tensorflow_build_dir }}" + removes: "{{ build_dir }}/tensorflow-{{ tensorflow_version }}" + when: onednn_build + +- name: Fetch TensorFlow{{ variant_name }} from git when: tensorflow_version == 'git' + ansible.builtin.git: + repo: "https://github.com/tensorflow/tensorflow.git" # noqa latest[git] + dest: "{{ tensorflow_build_dir }}/" + depth: 1 + recursive: true + force: true + +- name: Fetch TensorFlow{{ variant_name }} from git at commit {{ prebuild_hash }} + when: prebuild_release + ansible.builtin.git: + repo: "https://github.com/tensorflow/tensorflow.git" + dest: "{{ tensorflow_build_dir }}/" + version: "{{ prebuild_hash }}" + depth: 1 + recursive: true + force: true + +- name: Prepare TensorFlow source from git + when: tensorflow_version == 'git' or prebuild_release + block: + - name: Set world write access to source + ansible.builtin.file: + path: "{{ tensorflow_build_dir }}/" + state: directory + mode: 0777 + + - name: Get oneline version of git log for this checkout # noqa no-changed-when + ansible.builtin.command: + cmd: "git log --pretty=oneline -1" + chdir: "{{ tensorflow_build_dir }}/" + register: git_log + + - name: Show git log + ansible.builtin.debug: + var: git_log.stdout + + - name: Record git commit hash to variable + ansible.builtin.set_fact: + git_commit: "{{ git_log.stdout | regex_search('^[0-9a-f]+') }}" + + - name: Save git commit hash to file + ansible.builtin.template: + src: "git_commit_hash.j2" + dest: "{{ wheels_dir }}/git_commit_hash" + owner: buildslave + group: buildslave + mode: 0444 + force: true + |