0

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?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
Sharath Chandra
  • 654
  • 8
  • 26

1 Answers1

1

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

enter image description here

Josh Gust
  • 4,102
  • 25
  • 41
  • Thanks, Including the access token helped in getting the access to user. However, I still was not able to check-in since git was complaining about lack of user name and email in the git config. I used git.exec (https://www.npmjs.com/package/gulp-git#gitexecopt-cb) to set the git config – Sharath Chandra Mar 09 '19 at 08:37