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

Avoid unnecessary releases #1755

Closed
ahmadmayahi opened this issue Nov 6, 2018 · 8 comments
Closed

Avoid unnecessary releases #1755

ahmadmayahi opened this issue Nov 6, 2018 · 8 comments
Assignees

Comments

@ahmadmayahi
Copy link
Contributor

ahmadmayahi commented Nov 6, 2018

Q A
Issue Type Feature Request
Deployer Version 6.3.0
Local Machine OS All
Remote Machine OS All

Description

Each time I run dep deploy ..., the deployer will immediately work, and this is how it suppose to be, but sometimes I don't have any changes in my code, and if I run dep deploy ... a new unnecessary release will be created.

For example:

I use at command to run deployer every day at midnight:

at midnight dep deploy prod

Deployer has to skip the deployment if no changes were made into the git repo.

Solution

Whenever deployer finishes, a new file contains the last commit id will be created/updated in .dep folder.
The next time we deploy, deployer has to check if the current commit id matches the existing saved one, if so then it will skip the deployment.

I will work on this if accepted.

@antonmedv
Copy link
Member

Nice idea

@Chrico
Copy link

Chrico commented Aug 12, 2019

Howdy!

In versoin 6.4.7, this new "feature" will break deployment, if you don't have set any repository-URL.

This could be possible if you're doing e.G. a deploy via CI by running composer + rsync to push the code to server.

This command should only run if repository is set instead of run you should use runLocally - because you don't want to run this on the server: https://github.com/deployphp/deployer/blob/v6.4.7/recipe/deploy/prepare.php#L43-L45

image

Commit is here: bb4d41c#diff-47a8209fdc160285dc659ed27fba1861

@ahmadmayahi
Copy link
Contributor Author

@Chrico You just need to set the check_remote_head as follows:

# your ci deploy file.
set('check_remote_head', false)

@Chrico
Copy link

Chrico commented Aug 12, 2019

check_remote_head is false by default and never touched.

The problem is this line: https://github.com/deployphp/deployer/blob/v6.4.7/recipe/deploy/prepare.php#L45 which runs even if the repository is not set.

Additonally it could be possible, that the server has no access to the repo itself. So you should probably use runLocally instead of run here as well.

@ahmadmayahi
Copy link
Contributor Author

@Chrico You are right, I'll look into that. Thanks.

@antonmedv
Copy link
Member

I dot this. :) See 85aae9f

@antonmedv
Copy link
Member

Usage:

require 'recipe/deploy/check_remote.php';
after('deploy:prepare', 'deploy:check_remote');

@antonmedv
Copy link
Member

trim was added at #628, but I think this is incorrect.

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

3 participants