Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling {latest} via WebHook #97

Open
sontags opened this issue Dec 6, 2018 · 4 comments
Open

Pulling {latest} via WebHook #97

sontags opened this issue Dec 6, 2018 · 4 comments

Comments

@sontags
Copy link

sontags commented Dec 6, 2018

# caddy -version
Caddy 0.11.1 (non-commercial use only)

Considering the following Caddyfile:

http://www.example.com {
    root /web/www.example.com/public
    git https://github.com/example/example.com {
        hook     /path TOKEN
        branch   {latest}
        path     ..
        then     /hugo --destination=/web/www.example.com/public --cleanDestinationDir
    }
}

http://beta.example.com {
    root /web/beta.example.com/public
    git https://github.com/example/example.com {
        hook     /path TOKEN
        branch   master
        path     ..
        then     /hugo --destination=/web/beta.example.com/public --cleanDestinationDir
    }
}

The expected behaviour is:

  • On a commit/push to the repo beta.example.com will be updated.
  • On a commit/push to the repo www.example.com will NOT be updated. (Caddy log: 2018/12/06 12:00:55 github webhook ignored. Error: found different branch master).
  • On a tag/push --tags to the repo beta.example.com will be updated with no effect
  • On a tag/push --tags to the repo www.example.com will be updated to latest version.

Effective behaviour is:

  • commit/push works as expected.
  • tag/push --tags gives the following error for BOTH instances (www/beta):
    2018/12/06 12:02:44 github webhook ignored. Error: found different branch v1.0.4 where v1.0.4 is the latest tag.

A restart of Caddy results in the expected behaviour.

Is this a bug or is my understanding of the plugin wrong?

@sontags
Copy link
Author

sontags commented Dec 6, 2018

Probably related to #50

@sontags
Copy link
Author

sontags commented Dec 27, 2018

Any opinions on this? If this is a bug I am willing to dig into this. But I have no urge to write a PR if the current behavior intentional so it would be helpful to get some feedback.

@abiosoft
Copy link
Owner

That is a bug. It appears {latest} is deduced once at startup and kept using the static value afterwards.

@sontags
Copy link
Author

sontags commented Dec 27, 2018

Thanks, I'll have a try preparing a pr in the next few days!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants