Pablo Nuñez
Pablo Nuñez

Reputation: 21

Satis with private repo update Workflow

i Have a private repo on GitHub and configured Satis on my server.

Satis have only one tag i speficied called 0.9.1

Everithing working fine, i use the composer create-project command to create a new project on my computer with the repo contents, install composer dependencies, etc.

Now the question

suppose the repo continues development and now i have a tag called 0.9.2.

How can i update the project on my machine with the new repo tag.

I need to do additional tasks on the satis server? I need to run some command on my machine? Whats the best workflow for this scenario?

Tranks

UPDATE

My private repo on github https://github.com/pablonunez-dev/myproject

Files on my repo.

file1.txt
file2.txt
composer.json

this is the content of the composer.json file

{
"name": "myproject",
"description": "myproject",
"keywords": ["myproject", "application template"],
"homepage": "http://www.myserver.net/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
    "issues": "https://github.com/yiisoft/yii2/issues?state=open",
    "forum": "http://www.yiiframework.com/forum/",
    "wiki": "http://www.yiiframework.com/wiki/",
    "irc": "irc://irc.freenode.net/yii",
    "source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
    "php": ">=5.4.0",
    "yiisoft/yii2": "2.0.7"
},
"extra": {
    "asset-installer-paths": {
        "npm-asset-library": "vendor/npm",
        "bower-asset-library": "vendor/bower"
    }
}

}

this is my project configuration file on satis

{
    "name": "My Satis Packages Server",
    "homepage": "http://satis.myserver.net",
    "repositories": [
        { "type": "vcs", "url": "https://github.com/pablonunez-dev/myproject
          ],
    "require":
    {
        "myproject/core":"0.9.*"
    }
}

Now, when i go to my computer and run.

C:\composer create-project myproject/core test1 --repository-url=http://satis.myserver.net

It work well and create the folder and install dependencies from composer.json with the structure

file1.txt
file2.txt
vendor
composer.json
composer.lock

Now, the problem is, when i go to my repository and delete de file file1.txt and create another one with the name file3.txt, commit, push, recreate satis

How can i update the folder on my machine with the repo changes?

Thanks, again

Upvotes: 0

Views: 1461

Answers (1)

Sven
Sven

Reputation: 70863

It's best to have a script or one-click-job that does all the Satis update calls you need.

In general, your workflow would be like this:

  1. Update the software, commit and push it, and tag it with a new version number. Push the tag.
  2. Update the Satis repo data.
  3. Update your main package with composer update - this should fetch the new tag of the package.

Updating Satis probably is only one simple command line call, but it has parameters with files, and you don't want to remember them. Just add a simple shell script satis-update that calls Satis with the correct parameters. If possible, create a job on Jenkins or Bamboo or wherever that allows you to click a button that starts the update.

The best solution would be to add post-commit triggers to all repos that start the update once a tag has been pushed, but this is advanced. My own Satis instance hosts 120 internal packages, and Satis runs either once each night, or manually on demand if a developer needs the update quicker. It takes about 5 minutes to finish.

Note that you can omit the Satis update cycle by adding the repository you are developing with as an additional vcs repo. That way your main package can query the repository directly, and will know about new tags instantly. However, this is only really recommended during development times.

Upvotes: 2

Related Questions