Reputation: 1092
I'm currently developing a project containing an Angular SPA Frontend Repo and a nodeJS backend repo. I've been looking into ways, how to deploy my Applications to RHEL/centOS using Gitlab-CI after compiling/minifying my project. The problem is, I can't figure out, how to use eg. the YUI Compressor for shrinking within the gitlab-ci.yml file. I also have trouble to use eg SSH to deploy my files into my Public Folder on my webserver or to trigger pm2 to reload the application. I'd love to implement a basic unit testing in this approach, but I still can't get the hang of how it's done either. I'd be glad to hear any suggestions from you that could expand my knownledge. Thanks!
Upvotes: 1
Views: 172
Reputation: 68902
Assuming you're using yuicompressor as a jar, how about writing this in .gitlab-ci.yml:
build:
script:
- yuicompressor.sh
Make sure you have a shell script in your path, which chmod +x
bit set that does this:
#!/bin/sh
java -jar /path/to/your/yuicompressor-x.y.z.jar
That file must be on your runner vm called yuicompressor.sh. It doesn't seem good to me to hard-code paths to resources on your runners into .gitlab-ci.yml.
Note you might need different args to the java app.
I put all executable tools (mostly scripts) that my runners need into a folder /glrunner/tools
and place /glrunner/tools
into the PATH of my runner when I start it.
If you're having trouble because you're using Dockerized runners, get everything working OUTSIDE docker with a shell runner on a Linux VM, and later move to containers. This is the number one rookie mistake people make.
Once you're using containers and you have a Dockerfile to bring up your tooling, perhaps you won't need to consider static "tool/script" folders like I have initially suggested, but it's a good way to get started, learn Gitlab CI Runners first, then learn Docker.
Upvotes: 1