Auto Deploy to Server after Push on Git
I have some Codeigniter projects on some domains (on the same server) and the projects already in the git.
How should i do when I push to git then on the server get new update from git repository?
Anyone can explain me step by step?
See also questions close to this topic
Building dependency package from within node_modules
Current project I'm working on has a dependency inside
node_modules, as part of the CI process, we
cdinto the module's folder and run
npm installfollowed by running the module's build script with
npm buildand then move the build artifact back to the main project folder, where it can be used as a kind of "sub-application".
This seems really inefficient to me, at the least it seems unorthodox, and has me worried, but for certain reasons, seems to be the simplest solution to the problem we're faced with.
Are there any hidden gotchas associated with this approach? Will doing this potentially come back to bite me later on or any caveats I should be aware of?
How can I use different .npmrc files between local and CI environments?
I have an .npmrc file on my local machine which defines the proxy my organisation uses for accessing the outside world. All our npm calls are also routed through the organisation's systems and so for our local machines we have an .npmrc file set up to define the registry and proxy details.
When we send this to our CI pipeline, it is not internal to the org's network, so doesn't need all the same restrictions, but we still need to set one other npm value in the .npmrc file.
How can I have different sets of these settings for different environments?
I've looked at using something like
npm install --userconfig=".npmrc_ci", but in the CI platform that ended up just using the original .npmrc file (i.e. the local version). I've also tried setting each of my CI params in a script in my CI pipeline but that gives the same result.
How to automate versioning in TestFlight
I had automated upload to TestFlight with Azure DevOps from an Ionic Cordova app. Even though, we are currently deploying to production too. This combination, sometimes result in error ITMS-90062. Description of the error:
This bundle is invalid. The value for key CFBundleShortVersionString [3.0.0] in the Info.plist file must contain a higher version than that of the previously approved version [3.0.13]. Please find more information about CFBundleShortVersionString at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
Is there an automated way I can read which version is currently approved in the AppStore and related to this one can increase the versioning?
git commits heatmap for a newly created project from an existing one
I pushed an existing git project to Gitlab and wanted to have an intuitive impression of git commits history through the Gitlab heatmap. Yet from the heatmap, I could only tell that I pushed to this repo that day and all the previous git commit history wouldn't reflect in the heatmap.
Is there a way to show my previous git commits in the heatmap? Or is the heatmap only to reflect the actions caused by
gitlab server timeout after configuring custom port
I have successfully installed gitlab and run it with embedded nginx. I have also successfully activated https. But when I try to change the external Url port (in both modes http and https) I get a time out error in my browser.
For information, I am running gitlab on a remote Ubuntu 18.04.2 server available from a registered domain and browsing with both Chrome and Safari from my computer from home.
I have reconfigured gitlab already a hundred times. I have checked the different involved ports to make sure they are allowed by firewall and listened to by the expected processes. Everything looks fine to me.
In /etc/gitlab/gitlab.rb I have done what described on the gitlab website for custom ports:
external_url 'http://gitlab.mydomain.com:10443' ... nginx['enable'] = true
When on standard port 80 and 443 I get the access logs in /var/log/gitlab/nginx/gitlab_access.log. But as soon as I have added the custom port I don't see anything anymore.
Result of the 'ufw status verbose' cmd:
Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) New profiles: skip To Action From -- ------ ---- ... 8080/tcp ALLOW IN Anywhere 10443/tcp ALLOW IN Anywhere ... 8080/tcp (v6) ALLOW IN Anywhere (v6) 10443/tcp (v6) ALLOW IN Anywhere (v6)
Result of the 'netstat -tulpn' cmd:
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 14865/unicorn maste tcp 0 0 0.0.0.0:10443 0.0.0.0:* LISTEN 21422/nginx: master tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 21422/nginx: master
What is even weird is that when I perform cmd 'nc -vz gitlab.mydomain.com 10443', it succeeds:
Connection to gitlab.mydomain.com 10443 port [tcp/*] succeeded!
The request to http://gitlab.mydomain.com:10443 (or its SSL version when activated) ends up with a ERR_CONNECTION_TIMED_OUT on Chrome and 'Safari can't open the page "gitlab.mydomain.com:10443" because the server where this page is located isn't responding' on Safari.
minimize git diff by undoing trivial changes
When working with code (mostly c++ in my case) and specifically with git and gitlab, I often find myself working on a specific merge request and feature addition for several weeks. At the end, I arrive with a very long merge request that is very hard for the maintainers to understand, because I have committed a lot of changes.
Some of these changes are intentional and important to the feature at hand, others are trivial like fixing the indentation of a certain section of code, which I often to to improve readability while I'm debugging. However, in order for the MR to be as small as readable as possible, I'd like to "undo" all the trivial changes not affecting the code itself (but only the layout) before removing the WIP label from my MR. So I sometimes find myself going through my MR and undoing all those prettifications by hand in order to make the MR more readable for the reviewers.
This is a lot of stupid work that could be spent better elswhere.
Is there a script or mechanism that I can use (specifically on c++ code) to go through the code and undo all trivial changes (for example, whitespace changes) with respect to a certain commit? This would simplify my life significantly. I could see myself writing a script for this, but I'm hoping for there to be some git magic that I can use, or for someone else already having solved this issue for me. Any suggestions?
How do I add a timer to my gitlab-ci job to make it stop within 1 minute in gitlab-ci.yml
I have a spring boot application and I am configuring gitlab-ci.yml to run my integration tests. In order to achieve that I need my spring boot app running.
I am able to bring up my app using spring-boot-maven-plugin but the job I configured does not complete since the app is running and times out at 1 hour.
Is there a way to end a gitlab-ci job after a minute or two?
here is my gitlab-ci.yml config
server_start: stage: test script: - mvn spring-boot:start
Are there other examples of how to configure the gitlab-ci.yml to check if the server is up?
GitLab CI get last artifact
I'm trying to get the latest build artifact using
curl. Here's what I've tried.
First, get last pipeline id:
curl -v -H "Content-Type: application/json" -H "PRIVATE-TOKEN: <my-token-here>" https://<project>/api/v4/projects/<project>/pipelines?per_page=1&page=1
Next, get job id based on pipeline id just obtained before:
curl -sS --header "PRIVATE-TOKEN: <my-token-here>" "https://[redacted,host]/api/v4/projects/[redacted,project]/pipelines/<pipeline-id>/jobs" | jq '. | select(.name == "build-assets" and .status == "success" and .artifacts_file != null) | .id'
Finally, get the artifacts to
build.zipbased on job id:
curl -sS --header "PRIVATE-TOKEN: <my-token-here>" "https://[redacted,host]/api/v4/projects/[redacted, project]/jobs/<JOB_ID>/artifacts" > build.zip
These steps above do work, but I have to hit three endpoints (and process the JSON response for each step).
I also read in GitLab's documentation, that there's a single endpoint available for this. So I also tried this:
curl -sS --header "PRIVATE-TOKEN: <my-token-here>" "https://<url>/<namespace>/<project>/-/jobs/artifacts/<refs>/download?job=<job_name>"
but this always redirects me to the login page, saying this:
<html><body>You are being <a href="https://<url>/users/sign_in">redirected</a>.</body></html>
Is there any simpler way to do this task? Or how to use the endpoint that is described on the documentation above propeprly?
Automatic version increase in Cargo.toml for CI purposes
As part of my software's CI process, I also create Debian packets that I put into a staging repository, so that the software can be accessed on the ultimately intended fashion on testing systems. In order to create the DEB files, the
Cargo-debcrate is used, my (Gitlab) CI runner managing the staging repo does so using
The issue I am running into is the Debian package version.
versionproperty specified in
Cargo.tomlfor the created package meta information, whose semantic version triple should not change for many staging builds. At the moment, this forces me to manually adjust the version string to something like "X.Y.Z-preV" before every commit. If I ever forget to bump the "V" part of the version here, my pipeline will fail, as reprepro complains that it got the same version twice (assuming the rest of the build succeeded).
I could of course write a Shell script that in some way increments this value by parsing the
Cargo.tomlfile and rewriting the version line, but I keep wondering if there is a more elegant way to do this, perhaps utilizing some more obscure flags from
How to make correct use of sshpass along with password and different port?
I am building a job in jenkins in which i need to copy the folders and file from jenkins server to another server. The server has port 802 and password= "PASSWORD" how to copy folder to another server?
sshpass -p'PASSWORD'scp -P 802 $SSH_OPTS -r $WORKSPACE/target/abc.war email@example.com:/root/war/ Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters -f filename Take password to use from file -d number Use number as file descriptor for getting password -p password Provide password as argument (security unwise) -e Password is passed as env-var "SSHPASS" With no parameters - password will be taken from stdin -P prompt Which string should sshpass search for to detect a password prompt -v Be verbose about what you're doing -h Show help (this screen) -V Print version information At most one of -f, -d, -p or -e should be used Build step 'Execute shell' marked build as failure Finished: FAILURE
Bamboo plan: Compress the artifact after build and uncompress after deployment to server
This is my first time where I am learning and implementing automated CICD pipelines in Atlassian bamboo. I have a NodeJS project whose build and deployment plan I configured after much R&D over the net. In the deployment process, I observed that the deployment is taking very much time as the number of files to be transferred are more in numbers. I would like to compress the artifact generated after build steps and want to decompress at server side once the transfer is complete. I tried finding ZIP in the tool tasks but it is not there? My question is that is it possible in any other way. Is doing it via cmd works & is feasible? I have a little experience over the Linux command.
Any help would be highly appreciated.
Deploying code changes to IoT devices without direct access to it
I'm wondering what is the best way to keep continuous deployment on IoT machines (connected to the internet), but without direct access to it. The codebase is in Go; is it better to write my own agent which will check some endpoint for a new code package/repository, or is there a software (or SaaS) that solves that kind of problem already?
PS. IoT machines runs under Debian 9.x.
Loading Travis-CI cache takes as long as fresh install of all dependencies (using yarn)
Loading node_modules from build cache in TravisCI takes as much time as installing all the dependencies from the scratch with yarn command.
While trying to speed up our TravisCI build, we've wanted to cache node_modules and yarn so builds in our open PRs triggered by new commits don't have to always install all dependencies again.
The problem is that loading cached node_modules takes as much time as installing everything fresh new with yarn command. Is this expected behavior or are we using incorrectly written
Here is cache part our
cache: yarn: true directories: - node_modules - ~/.cache #this one caches Cypress binary which is saved at '/home/travis/.cache/Cypress' (more info here: https://docs.cypress.io/guides/guides/continuous-integration.html#Caching)
I certainly hoped that using cache would save us some time. But loading cache takes 49 seconds vs. running yarn takes 51. Not a huge performance boost.
The specified task executable location is invalid while running GitLab CI Job
I'm trying to set up CICD for my .NET Core application with GitLab CI.
Let's start with my
image : microsoft/dotnet:latest before_script: - 'cd Backend' - 'dotnet restore' build: stage: build script: - 'dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=Properties/PublishProfiles/WebioProfile.pubxml' only: - cicd_test
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <WebPublishMethod>MSDeploy</WebPublishMethod> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedPlatform>Any CPU</LastUsedPlatform> <SiteUrlToLaunchAfterPublish>http://xxx.hostingasp.pl/</SiteUrlToLaunchAfterPublish> <ExcludeApp_Data>False</ExcludeApp_Data> <ProjectGuid>03120c29-ae98-4c30-9b8c-7ec70f6642fd</ProjectGuid> <MSDeployServiceURL>ssl3.xxxx.hostingasp.pl</MSDeployServiceURL> <DeployIisAppPath>xxxx.hostingasp.pl</DeployIisAppPath> <RemoteSitePhysicalPath /> <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer> <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod> <EnableMSDeployBackup>True</EnableMSDeployBackup> <UserName>user</UserName> <Password>password</Password> </PropertyGroup> </Project>
git push origin cicd_test
I got this error GitLab Job console
Restore completed in 58.11 ms for /builds/username/project/Backend/Backend.csproj.
Backend -> /builds/username/project/Backend/bin/Release/netcoreapp2.1/Backend.dll Backend -> /builds/username/project/Backend/obj/Release/netcoreapp2.1/PubTmp/Out/ /usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk.Publish/build/netstandard1.0/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeploy.targets(171,5): error MSB6004: The specified task executable location "%ProgramW6432%/IIS/Microsoft Web Deploy V3/msdeploy.exe" is invalid. [/builds/username/project/Backend/Backend.csproj]
From what I see,
%ProgramW6432%is some kind of variable that isnt set? But where I can change it?
Worth to notice, deploying using same commands as in
.gitlab-ci.ymlworks fine if I run it localy from VS CLI