Page MenuHomeDevCentral

Generate Cargo documentation automatically and publish it to docs.nasqueron.org
Closed, ResolvedPublic

Description

A Jenkins task should be run when a new commit is pushed to rLF master branch with something like:

#!/bin/sh

cargo doc --no-deps
scp -rp target/doc/* ysul.nasqueron.org:/var/wwwroot/nasqueron.org/docs/limiting-factor/rust/

That will push new crate documentation to http://docs.nasqueron.org/limiting-factor/rust/limiting_factor

Event Timeline

dereckson created this task.Sep 6 2018, 18:55
dereckson updated the task description. (Show Details)

Artifact

With this pipeline, documentation is generated at https://cd.nasqueron.org/job/limiting-factor-doc/lastSuccessfulBuild/artifact/*zip*/archive.zip.

If we decompress the archive, documentation is in the archive/target/doc/ folder.

Next step

One of them:

  • Publish to docs.nasqueron.org through Jenkinsfile (requires the node and Ysul to be configured with a relevant ssh key)
  • Publish through Jenkins ssh plugin (solution used on the old CI, probably not compatible with pipelines, credentials were in Jenkins)
  • Trigger a Salt task to fetch the artifact archive and publish it
dereckson updated the task description. (Show Details)Sep 12 2018, 22:20
dereckson updated the task description. (Show Details)

Jenkins job works.

Job is triggered by H16 on commit. The Herald rule has successfully been triggered by 80ee76e8cdcf and successfully triggered the build 16 on Jenkins.

Jenkinsfile
node('rust') {
    stage('Checkout') {
        git 'https://devcentral.nasqueron.org/source/limiting-factor.git'
    }

    try {
        stage('Build')  {
            sh 'cargo build'
        }

        stage('Doc') {
            sh 'cargo doc || cargo doc --no-deps'
            sh '''
                cd target/doc
                tar czf ../doc.tar.gz *
            '''
        }
    } finally {
         archiveArtifacts artifacts: 'target/doc/**', onlyIfSuccessful: true
         archiveArtifacts artifacts: 'target/doc.tar.gz', onlyIfSuccessful: true
         
         stage('Publish') {
            sshPublisher(
                failOnError: true,
                publishers: [
                    sshPublisherDesc(
                        configName: 'ysul-deploy',
                        verbose: true,
                        transfers: [
                            sshTransfer(
                                sourceFiles: 'target/doc.tar.gz',
                                removePrefix: 'target/',
                                remoteDirectory: 'workspace',
                                cleanRemote: true,
                                execCommand: 'tar xzvf workspace/doc.tar.gz -C /var/wwwroot/nasqueron.org/docs/limiting-factor/rust/'
                            )
                        ]
                    )
                ]
            )
        }
    }
}
dereckson claimed this task.Oct 4 2018, 23:57
dereckson closed this task as Resolved.