Skip to content

Commit

Permalink
fix: add useCITemp option
Browse files Browse the repository at this point in the history
  • Loading branch information
yugasun committed Sep 15, 2020
1 parent a82429d commit 37f0d67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/apis/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function createCodingCIJobReq({
depotId,
envs = [],
pipeline,
useCITemp = false,
}: CreateCodingCIJobOptions): CreateCodingCIJobRequest {
if (!pipeline) {
pipeline = new Pipeline();
Expand All @@ -56,9 +57,16 @@ function createCodingCIJobReq({
let steps = stage.addSteps();
steps.addShell('env');
steps.addShell('date');
steps.addShell('echo TENCENT_SECRET_ID=$TENCENT_SECRET_ID > .env');
steps.addShell('echo TENCENT_SECRET_KEY=$TENCENT_SECRET_KEY >> .env');
steps.addShell('echo TENCENT_TOKEN=$TENCENT_TOKEN >> .env');
if (useCITemp) {
steps.addShell('echo TENCENT_SECRET_ID=$TENCENT_TEMP_SECRET_ID > .env');
steps.addShell('echo TENCENT_SECRET_KEY=$TENCENT_TEMP_SECRET_KEY >> .env');
steps.addShell('echo TENCENT_TOKEN=$TENCENT_TEMP_TOKEN >> .env');
} else {
steps.addShell('echo TENCENT_SECRET_ID=$TENCENT_SECRET_ID > .env');
steps.addShell('echo TENCENT_SECRET_KEY=$TENCENT_SECRET_KEY >> .env');
steps.addShell('echo TENCENT_TOKEN=$TENCENT_TOKEN >> .env');
}

steps.addShell('echo SERVERLESS_PLATFORM_VENDOR=tencent >> .env');
steps.addShell('echo SERVERLESS_PLATFORM_STAGE=$SERVERLESS_PLATFORM_STAGE >> .env');

Expand Down
2 changes: 1 addition & 1 deletion src/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function request(capi: Capi, options: RequestOptions): Promise<any | ApiEr
try {
const reqData = cleanEmptyValue(options) as RequestData;
const res = await capi.request(reqData, {
isV3: true,
isV3: false,
debug: false,
host: 'coding.tencentcloudapi.com',
RequestClient: 'slsplus_coding',
Expand Down
2 changes: 2 additions & 0 deletions src/typings/ci-interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ export interface CreateCodingCIJobOptions {
envs?: CIJobEnv[];
// for customizing pipeline
pipeline?: PipelineInterface;
// 是否使用 CI 提供的临时密钥作为鉴权信息,默认为 false
useCITemp?: boolean;
}

export interface CreateCodingCIJobRequest {
Expand Down

0 comments on commit 37f0d67

Please sign in to comment.