Git Product home page Git Product logo

Comments (9)

pat-s avatar pat-s commented on August 17, 2024 1

At least mlr-org/mlr@12864ca was not up-to-date with the most recent commits in the problematic build. https://travis-ci.org/mlr-org/mlr/jobs/400392404#L2296. This maybe then triggered a commit that deployed a historic state.
Nevertheless, only NEWS was staged and in any case nothing more should have been deployed here.

Maybe inserting another git pull after git checkout -B <branch> helps?

from tic.

pat-s avatar pat-s commented on August 17, 2024

We also faced this in mlr: mlr-org/mlr@12864ca

from tic.

krlmlr avatar krlmlr commented on August 17, 2024

Thanks. It's strange that other files were deployed besides NEWS. The safest thing would be to operate on FETCH_HEAD, commit there, and then try to deploy that to master. If this fails then probably another commit got in the way, and we fail the deploy (maybe push to a new branch beforehand). I'll take care of checking this in #62.

from tic.

krlmlr avatar krlmlr commented on August 17, 2024

Tricky problem here.

Suppose master has commits A, B, C, CI runs for commit A. The deployment is run against commit A, but we need to add our commit on top of commit C (otherwise we can't push).

A--B--C then becomes A--B--C--A' .

The issue described here arises because the code incorrectly issues git reset C when A is checked out. This doesn't change the file system contents for the clone, and has the effect that A' reverts C and B.

What are the alternatives?

  • Do not reset, commit A' on top of A. What then? One of:
    1. Fail when pushing
    2. Run git pull --rebase
    3. Push to a separate branch, issue a pull request
    4. Create and push a synthetic commit X to trigger another CI run
    5. Do nothing
  • When deploying, always use the latest tip. This doesn't guarantee that deployment uses tested code
  • Rebase to A--A'--B--C, then force-push -- very risky
    • What if C has [ci skip], will a CI run be started for B?
    • What if CI for B is already running? What if CI for B has completed before?
  • ?

from tic.

krlmlr avatar krlmlr commented on August 17, 2024

Maybe a feasible strategy:

  • Commit A' on top of A in a branch
  • Reset to C
  • Cherry-pick A' onto C
    • Failure: fail deploy
    • Success: go on

from tic.

pat-s avatar pat-s commented on August 17, 2024

Great that you figured out the problem already!

Not sure if it helps, but the git commands we used in mlr never triggered such problems.

Maybe you can get inspired by them to solve this problem here.
Looks very basic but does a robust job in practice.
https://github.com/mlr-org/mlr/blob/deaad6496df63de10b8d1af0b3f6b6663dea3fd5/.travis.yml#L52-L67

    - git checkout master
    - "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
    - R --no-save <<< "devtools::document(roclets=c('rd', 'collate', 'namespace'))"
    - ./thirdparty/gen_families.sh > man/mlrFamilies.Rd
    - git config user.name $GN
    - git config user.email $GM
    - git config credential.helper "store --file=.git/credentials"
    - bash inst/convert_to_ascii_news.sh
    - echo "https://$GT:@github.com" >> .git/credentials
    - git config push.default matching
    - git add --force NEWS
    - git add --force man/*
    - git add --force NAMESPACE
    - git commit man DESCRIPTION NAMESPACE NEWS -m "update auto-generated documentation [ci skip]" || true
    - git push
    - "[ $TRAVIS_PULL_REQUEST == \"false\" -a $TRAVIS_BRANCH == \"master\" ] && curl -s -X POST -H \"Content-Type:application/json\" -H \"Accept:application/json\" -H \"Travis-API-Version:3\" -H \"Authorization:token $TT\" -d \"{\\\"request\\\":{\\\"branch\\\":\\\"gh-pages\\\", \\\"message\\\":\\\"commit $TRAVIS_COMMIT $TRAVIS_COMMIT_MSG\\\"}}\" https://api.travis-ci.org/repo/mlr-org%2Fmlr-tutorial/requests"

from tic.

krlmlr avatar krlmlr commented on August 17, 2024

Thanks. This does look interesting but how are race conditions dealt with in your script? It looks like the git push will just fail -- not ideal.

Cherry-picking seems to work.

from tic.

pat-s avatar pat-s commented on August 17, 2024

It looks like the git push will just fail -- not ideal.

Probably. Not ideal but safe - and since we only use it for automatic man/ deployment, this will just be done in the last commit that isn't in a race.
But if you deploy other files its not perfect, sure.

Cherry-picking seems to work.

If that works, great 👍

from tic.

krlmlr avatar krlmlr commented on August 17, 2024

Implemented in e136aa2.

from tic.

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.