Skip to content
Snippets Groups Projects
Select Git revision
21 results Searching

migration.spec.ts

Blame
  • index.ts 31.03 KiB
    import url, { URLSearchParams } from 'url';
    import delay from 'delay';
    import { RenovateConfig } from '../../config/common';
    import {
      REPOSITORY_CHANGED,
      REPOSITORY_DISABLED,
      REPOSITORY_NOT_FOUND,
    } from '../../constants/error-messages';
    import { PLATFORM_TYPE_BITBUCKET_SERVER } from '../../constants/platforms';
    import { PR_STATE_ALL, PR_STATE_OPEN } from '../../constants/pull-requests';
    import { logger } from '../../logger';
    import { BranchStatus } from '../../types';
    import * as gitfs from '../../util/gitfs';
    import * as hostRules from '../../util/host-rules';
    import { HttpResponse } from '../../util/http';
    import {
      BitbucketServerHttp,
      setBaseUrl,
    } from '../../util/http/bitbucket-server';
    import { sanitize } from '../../util/sanitize';
    import { ensureTrailingSlash } from '../../util/url';
    import {
      BranchStatusConfig,
      CommitFilesConfig,
      CreatePRConfig,
      EnsureCommentConfig,
      EnsureCommentRemovalConfig,
      EnsureIssueConfig,
      EnsureIssueResult,
      FindPRConfig,
      Issue,
      PlatformConfig,
      Pr,
      RepoConfig,
      RepoParams,
      VulnerabilityAlert,
    } from '../common';
    import { smartTruncate } from '../utils/pr-body';
    import { BbbsRestPr, BbsConfig, BbsPr, BbsRestUserRef } from './types';
    import * as utils from './utils';
    import { PartialDeep } from 'type-fest';
    /*
     * 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: any = {
      hostType: PLATFORM_TYPE_BITBUCKET_SERVER,
    };
    
    /* istanbul ignore next */
    function updatePrVersion(pr: number, version: number): number {
      const res = Math.max(config.prVersions.get(pr) || 0, version);
      config.prVersions.set(pr, res);
      return res;
    }
    
    export function initPlatform({
      endpoint,
      username,
      password,