Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

index.ts

Blame
    • Rhys Arkins's avatar
      dca3418b
      refactor: lib/modules (#14488) · dca3418b
      Rhys Arkins authored
      Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/
      
      BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
      dca3418b
      History
      refactor: lib/modules (#14488)
      Rhys Arkins authored
      Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/
      
      BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
    index.ts 29.14 KiB
    import url from 'url';
    import is from '@sindresorhus/is';
    import delay from 'delay';
    import JSON5 from 'json5';
    import type { PartialDeep } from 'type-fest';
    import { PlatformId } from '../../../constants';
    import {
      REPOSITORY_CHANGED,
      REPOSITORY_EMPTY,
      REPOSITORY_NOT_FOUND,
    } from '../../../constants/error-messages';
    import { logger } from '../../../logger';
    import { BranchStatus, PrState, VulnerabilityAlert } from '../../../types';
    import type { GitProtocol } from '../../../types/git';
    import type { FileData } from '../../../types/platform/bitbucket-server';
    import * as git from '../../../util/git';
    import { deleteBranch } from '../../../util/git';
    import * as hostRules from '../../../util/host-rules';
    import {
      BitbucketServerHttp,
      setBaseUrl,
    } from '../../../util/http/bitbucket-server';
    import type { HttpResponse } from '../../../util/http/types';
    import { newlineRegex, regEx } from '../../../util/regex';
    import { sanitize } from '../../../util/sanitize';
    import { ensureTrailingSlash, getQueryString } from '../../../util/url';
    import type {
      BranchStatusConfig,
      CreatePRConfig,
      EnsureCommentConfig,
      EnsureCommentRemovalConfig,
      EnsureIssueConfig,
      EnsureIssueResult,
      FindPRConfig,
      Issue,
      MergePRConfig,
      PlatformParams,
      PlatformResult,
      Pr,
      RepoParams,
      RepoResult,
      UpdatePrConfig,
    } from '../types';
    import { smartTruncate } from '../utils/pr-body';
    import type {
      BbsConfig,
      BbsPr,
      BbsRestBranch,
      BbsRestPr,
      BbsRestRepo,
      BbsRestUserRef,
    } from './types';
    import * as utils from './utils';
    
    /*
     * Version: 5.3 (EOL Date: 15 Aug 2019)
     * See following docs for api information:
     * https://docs.atlassian.com/bitbucket-server/rest/5.3.0/bitbucket-rest.html
     * https://docs.atlassian.com/bitbucket-server/rest/5.3.0/bitbucket-build-rest.html
     *
     * See following page for uptodate supported versions
     * https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html#AtlassianSupportEndofLifePolicy-BitbucketServer
     */
    
    let config: BbsConfig = {} as any;
    
    const bitbucketServerHttp = new BitbucketServerHttp();
    
    const defaults: {
      endpoint?: string;