Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a Gitlab repository containing a WordPress theme - php, js, and css files. My desired result is that when I push a change to the 'main' branch of the repo, the theme files are deployed, raw, without any build or test steps, to my remote server.

I have a .gitlab-ci.yml file set up with 'deploy' as its only step.

The script triggers on 'only: -main' and successfully accesses my remote server via ssh.

What I'm unsure of is how to send the entire raw repository to the remote.

Here is the 'script' portion of my yml:

- rsync -rav --delete project-name/ /var/opt/gitlab/git-data/repositories/project-name/ [email protected]:public_html/wp-site/wp-content/themes/

When the pipeline runs, I receive the following two errors:

rsync: [sender] change_dir "/builds/username/project-name/project-name" failed: No such file or directory (2)

rsync: [sender] change_dir "/var/opt/gitlab/git-data/repositories/project-name" failed: No such file or directory (2)

Is GitLab looking in /builds/ its default behavior? I am not instructing it to do so in my yml.

Is there some other file path I should be using to access the working tree for 'main' in my repository?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.7k views
Welcome To Ask or Share your Answers For Others

1 Answer

Ok, I misunderstood the rsync syntax. I thought the --delete flag included a parameter thereafter, meaning 'delete any existing files in the following directory' rather than what it actually does, which is to auto-choose the destination directory. Once I removed 'project-name/' and corrected the GitLab (origin) file path to '/builds/username/project-name/' the deployment occurs as intended.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...