Skip to content

Commit

Permalink
Get the local datalab git version and pass it to the docker build (#37)
Browse files Browse the repository at this point in the history
* Get the local datalab git version and pass it to the API docker build

* Get the local datalab git version and pass it to the API docker build

* Also pass app version in build

* Bump README versions

* Fix ansible lint suggestions
  • Loading branch information
ml-evs authored Nov 12, 2024
1 parent 724af20 commit 0069d34
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Attempts will be made to tabulate the supported versions of datalab with each re
|---|---|
| v0.1.x | v0.4.x |
| v0.2.x | v0.4.x |
| v0.3.x | v0.5.x+ |
| v0.3.x | v0.5.0-rc.x |
| v0.4.x | v0.5.x |


## Overview
Expand Down
20 changes: 20 additions & 0 deletions ansible/roles/datalab/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
dest: "{{ ansible_user_home_dir }}/datalab/pydatalab/.env"
mode: "0644"

- name: Get git tag version locally to use as fact # noqa: command-instead-of-module
delegate_to: localhost
ansible.builtin.shell:
cmd: set -o pipefail && git describe --tags --match 'v*' | sed 's/^v//' | sed 's/-rc/rc/' | sed 's/-/+/'
chdir: "{{ playbook_dir }}/../src/datalab"
register: git_tag
changed_when: false

- name: Set fact for git tag version
ansible.builtin.set_fact:
git_tag: "{{ git_tag.stdout }}"

- name: Write git version to a .env file to be loaded by build
ansible.builtin.copy:
content: "SETUPTOOLS_SCM_PRETEND_VERSION={{ git_tag }}\nVUE_APP_GIT_VERSION={{ git_tag }}"
dest: "{{ ansible_user_home_dir }}/datalab/.env_version"
mode: "0644"

- name: Copy encrypted API config file from vault
ansible.builtin.copy:
src: "{{ playbook_dir }}/vaults/datalab/prod_config.json"
Expand All @@ -38,6 +56,7 @@
build: always
env_files:
- "{{ ansible_user_home_dir }}/datalab/pydatalab/.env"
- "{{ ansible_user_home_dir }}/datalab/.env_version"

- name: Check whether ssh config exists
ansible.builtin.stat:
Expand Down Expand Up @@ -85,6 +104,7 @@
build: always
env_files:
- "{{ ansible_user_home_dir }}/datalab/webapp/.env"
- "{{ ansible_user_home_dir }}/datalab/.env_version"

- name: Add daily backup task to crontab
ansible.builtin.cron:
Expand Down

0 comments on commit 0069d34

Please sign in to comment.