Giter VIP home page Giter VIP logo

Comments (7)

sebalix avatar sebalix commented on July 16, 2024

Ok, I remember why I put the update=no statement in the playbook: to avoid an undesirable update to the last version of a given branch (odoo_repo_rev) when running the playbook a second time, which could bring regressions.

So, update should be removed (it is set to yes by default), and the clone task should not be run if the cloned directory already exists, as it is already done for Mercurial repositories. Is that ok for you?

from ansible-odoo.

clonedagain avatar clonedagain commented on July 16, 2024

That's how I've set up my extra repos, but it feels awkward (I had to
use a shell task).
I'm new to Ansible but I feel that's not what a play should do. It's
supposed to setup the target into a well known state, so if the config
says it's a branch we should probably just checkout the branch with no
further ado.
If we want a specific commit deployed we can set {{ odoo_repo_rev }}.

from ansible-odoo.

sebalix avatar sebalix commented on July 16, 2024

I agree, but in a day-to-day work, I don't want to pick a changeset hash on the remote repo and update my Ansible configuration, as we make releases manually on the server. What if we add an option to ensure update=no/yes (default yes)?
To test if a directory exists, there is the stat module: http://docs.ansible.com/stat_module.html#examples

from ansible-odoo.

clonedagain avatar clonedagain commented on July 16, 2024

I'm trying to use Ansible mainly to bootstrap/resync my development
hosts from the production server.
Come to think of it, what I want to do is simply point odoo_repo_url,
and let Ansible reset the repo for me to the same state as production.
I'd even so far as to suggest we remove force=no too, so we really
know what to expect.
Currently I use a custom bash script to do just that, and then
automatically merge all the dev branches in, so it feels most natural to me.

Still, I see your point, and when I bootstrap the production server I do
the same as you. I just fell dirty doing it. Here's how I do it for my
extra repos, let me know if you find a more proper way.

  - shell: "[ -d /home/{{ odoo_user }}/{{ item }}/ ] ||git clone
git@git:/srv/git/odoo/{{item}}.git /home/{{ odoo_user }}/{{ item }}"

An option for |update=no/yes |won't do the job, because git : update=no has no "effect" (it only queries the remote server but
creates nothing locally).
You could add an option to decide whether to checkout every time (using
git: ... force=yes), or only the first time (using shell:). I
suggest it should be "checkout everytime" by default.

If that's too much trouble, you may just close this issue and I'll take
no offense: I think I can use tags to skip the git part of the role and
do my own stuff in my playbook.

from ansible-odoo.

sebalix avatar sebalix commented on July 16, 2024

That's right, by default it should be force=yes and update=yes as this is the purpose of an Ansible role as you said. I need to override these values, because sometimes we prefer to avoid this behaviour (e.g. I prefer not to lose non-committed changes on my development VM by running its playbook). For production servers the default behaviour is a better choice.

I will add two options odoo_repo_update: True and odoo_repo_force: True, with an identical behaviour for Git and Mercurial repositories.

from ansible-odoo.

sebalix avatar sebalix commented on July 16, 2024

Finally, I just added one option odoo_repo_update: True + remove the force statement. Having equivalent control on the force part with Hg and Git is a bit awkward, so one option is enough (there is no real need to have an update on the working copy but without lose uncommitted changes (playbook hanging on a merge is not acceptable...)).
With this option we can run playbooks repeatedly on development environments without risk of losing uncommitted changes, it's all what I wanted!

You can check my branch fix-issue-8
Is this ok for you?

from ansible-odoo.

clonedagain avatar clonedagain commented on July 16, 2024

Thanks, for the moment I've switch to a custom play to deploy all my git repos because of #2 but I think what you did is OK.

from ansible-odoo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.