将Jenkins构建部署到Sonatype Nexus

将Jenkins构建部署到Sonatype Nexus

问题描述:

I have already integrated sonar-cube,Jenkins and git lab.Is there a way to add the Jenkins build result (my all projects are php Angular) to the Sonatype Nexus repository (Sonatype Nexus already installed)?

我已经集成了 sonar-cube code>, Jenkins code>和 git lab code>。有没有办法将 Jenkins code>构建结果(我的所有项目都是 php Angular code>)添加到 Sonatype Nexus repository(已安装 Sonatype Nexus code>)? p> div>

For PHP dependency management, much better suited is Composer.

Nexus is great for Java projects (they can be built automatically by Jenkins with a tool like Maven, Gradle). Nexus is great for compiled code.

Please also see:

Run a shell command after building to pack your project as tar.gz and upload it to a nexus server. The following example is for nexus 2.*. You will have to check the curl sintax for Nexus 3. It will run composer, zip the release with specific vendors without forcing you to have to run composer install on your client environment. Note the variables you will have to add.

Make sure you always do a clean install by checking out the c

if [ -f composer.json ]; then composer install; fi;
tar -zcvf ../`echo $JOB_NAME-$RELEASE.tar.gz | sed -e s/'- Release'/''/g  | sed -e s/'\-\-'/'\-'/g |  tr -d ' ' ` ./
mv ../`echo $JOB_NAME-$RELEASE.tar.gz | sed -e s/'- Release'/''/g  | sed -e s/'\-\-'/'\-'/g |  tr -d ' ' ` ./
curl -v \
    -F r=releases \
    -F g=com.acme \
    -F a=widget \
    -F v=$RELEASE \
    -F p=tar.gz \
    -F file=@./`echo $JOB_NAME-$RELEASE.tar.gz | sed -e s/'- Release'/''/g  | sed -e s/'\-\-'/'\-'/g |  tr -d ' ' ` \
-u $USER_LOGIN:$USER_PASSWORD \
http://127.0.0.1:8081/nexus/service/\local/repositories/php/content`echo $JOB_NAME-$RELEASE.tar.gz | sed -e s/'- Release'/''/g  | sed -e s/'\-\-'/'\-'/g |  tr -d ' ' `
rm -f `echo $JOB_NAME-$RELEASE.tar.gz | sed -e s/'- Release'/''/g  | sed -e s/'\-\-'/'\-'/g |  tr -d ' ' `