【问题标题】:gulp task is failing in azure devops ci pipelinegulp 任务在 azure devops ci 管道中失败
【发布时间】:2021-05-10 10:55:13
【问题描述】:

我在 azure devops 构建管道中的 gulp 任务中遇到了一些问题。任务因以下错误而失败。无法找到实际错误的位置。请帮助跟踪 gulp 配置中的错误。提前致谢

错误:

Error deploying { Error: read ECONNRESET
    at exports._errnoException (util.js:1026:11)
    at TLSWrap.onread (net.js:569:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
Job's done!

Gulp 任务:

gulp.task("upload:cdn", function () {
    var logger = console.log;
    var files = [];
    var opts = {
        serviceOptions: ['XXX', 'YYYY'], // custom arguments to azure.createBlobService 
        containerName: 'biz-core', // container name in blob 
        containerOptions: { publicAccessLevel: "blob" }, // container options 
        folder: 'assets', // path within container 
        deleteExistingBlobs: false, // true means recursively deleting anything under folder 
        concurrentUploadThreads: 2, // number of concurrent uploads, choose best for your network condition 
        zip: false, // gzip files if they become smaller after zipping, content-encoding header will change if file is zipped 
        metadata: { cacheControl: 'public,max-age=31536000' }, // metadata for each uploaded file 
        testRun: false // test run - means no blobs will be actually deleted or uploaded, see log messages for details 
    };
    deploy(opts, files, logger, function (err) {
        if (err) {
            console.log("Error deploying", err);
        }
        console.log('Job\'s done!');
    });
});

【问题讨论】:

  • 本地运行gulp命令,结果如何?尝试在管道中将变量system.debug设置为True,看看是否可以获得更多日志。

标签: azure-devops gulp continuous-integration build-pipeline


【解决方案1】:

“ECONNRESET”似乎连接错误。您可以查看gulp-deploy-azure-cdn 插件,因为您尝试将文件上传到 Azure Blob 存储。

  npm install gulp-deploy-azure-cdn 

使用:

var deployCdn = require('gulp-deploy-azure-cdn');
var gulp = require('gulp');
var gutil = require('gulp-util');
 
gulp.task('upload-app-to-azure', function () {
    return gulp.src(['*.js','*.json'], {
        base: 'node_modules/deploy-azure-cdn' // optional, the base directory in which the file is located. The relative path of file to this directory is used as the destination path
    }).pipe(deployCdn({
        containerName: 'test', // container name in blob
        serviceOptions: ['blobstoragename', '/OwQ/MyLongSecretStringFromAzureConfigPanel'], // custom arguments to azure.createBlobService
        folder: '1.2.35-b27', // path within container
        zip: true, // gzip files if they become smaller after zipping, content-encoding header will change if file is zipped
        deleteExistingBlobs: true, // true means recursively deleting anything under folder
        concurrentUploadThreads: 10, // number of concurrent uploads, choose best for your network condition
        metadata: {
            cacheControl: 'public, max-age=31530000', // cache in browser
            cacheControlHeader: 'public, max-age=31530000' // cache in azure CDN. As this data does not change, we set it to 1 year
        },
        testRun: false // test run - means no blobs will be actually deleted or uploaded, see log messages for details
    })).on('error', gutil.log);
});

【讨论】:

  • 你查看我的回复了吗?有用吗?
猜你喜欢
  • 2020-05-13
  • 2020-11-09
  • 2021-08-09
  • 2022-07-15
  • 2023-04-08
  • 1970-01-01
  • 1970-01-01
  • 2021-07-28
  • 2022-01-22
相关资源
最近更新 更多