0
votes

I am creating a release for my Node.js project. The build is configured on gulp.

As a part of the build steps, I need to:

  1. checkout the master and create a new release branch
  2. Update the version on the release branch
  3. commit and push the release branch

All these steps are configured using gulp as


gulp.task('release', gulpSequence(
    'checkout-release-branch',
    'bump-version',
    'clean:dist',
    'compile-ts',
    'commit-appversion-changes-to-release',
    'push-release-branch'
));


gulp.task('checkout-release-branch', function () {

    const packageJSON = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
    git.checkout('release-' + appVersion, { args: '-b' }, function (err) {
        if (err) throw err;
    });
});

gulp.task('bump-version', function () {
    return gulp.src(['./package.json'])
        .pipe(bump({ version: appVersion }).on('error', log.error))
        .pipe(gulp.dest('./'));
});

gulp.task('commit-appversion-changes-to-release', function () {
    return gulp.src('.')
        .pipe(git.add())
        .pipe(git.commit('[Release] Bumped package version number for release'));
});

gulp.task('push-release-branch', function () {
    git.push('origin', 'release-' + appVersion, { args: " -u" }, function (err) {
        if (err) throw err;
    });
});


The above steps when I am running on Azure DevOps give an error for user credentials not being set. I am not sure under what context the build is running. I have given access create and commit branches for "Project Collection Build Service".

What is the way for set credentials for git when I am using gulp-git in Azure DevOps CI builds?

1
Do you use Hosted agent or Private agent?Shayki Abramczyk
I have a hosted agent, running ubuntu 16.04Sharath Chandra
don't know if this can be achived with gulp-git but i had a similiar problem a while ago. i then used the variable 'system.accesstoken' in the header when pushing my changes but i was doing it on the commandlineD.J.

1 Answers

1
votes

Have you tried using the OAuth token (yaml or designer)?

enter image description here