support install without config
This commit is contained in:
14
action.yml
14
action.yml
@@ -9,22 +9,22 @@ branding:
|
|||||||
|
|
||||||
# Define your inputs here.
|
# Define your inputs here.
|
||||||
inputs:
|
inputs:
|
||||||
|
ossutil-version:
|
||||||
|
description: 'The OSSUTIL version to download and use, or "latest" for the latest version.'
|
||||||
|
required: true
|
||||||
|
default: '1.7.14'
|
||||||
endpoint:
|
endpoint:
|
||||||
description: 'The endpoint of your bucket'
|
description: 'The endpoint of your bucket'
|
||||||
required: true
|
required: false
|
||||||
access-key-id:
|
access-key-id:
|
||||||
description: 'The AccessKey ID of the credentials'
|
description: 'The AccessKey ID of the credentials'
|
||||||
required: true
|
required: false
|
||||||
access-key-secret:
|
access-key-secret:
|
||||||
description: 'The AccessKey Secret of the credentials'
|
description: 'The AccessKey Secret of the credentials'
|
||||||
required: true
|
required: false
|
||||||
sts-token:
|
sts-token:
|
||||||
description: 'The STS Token of the credentials'
|
description: 'The STS Token of the credentials'
|
||||||
required: false
|
required: false
|
||||||
ossutil-version:
|
|
||||||
description: 'The OSSUTIL version to download and use, or "latest" for the latest version.'
|
|
||||||
required: false
|
|
||||||
default: '1.7.14'
|
|
||||||
github-token:
|
github-token:
|
||||||
description: 'The GitHub token used to call API to fetch the latest version info'
|
description: 'The GitHub token used to call API to fetch the latest version info'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
62
dist/index.js
generated
vendored
62
dist/index.js
generated
vendored
@@ -32940,32 +32940,8 @@ const installer = __importStar(__nccwpck_require__(2574));
|
|||||||
*/
|
*/
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
// download
|
install();
|
||||||
const version = core.getInput('ossutil-version');
|
config();
|
||||||
await installer.installOssutil(version);
|
|
||||||
core.info('ossutil is successfully installed');
|
|
||||||
// config
|
|
||||||
const inputOptions = { required: true };
|
|
||||||
const endpoint = core.getInput('endpoint', inputOptions);
|
|
||||||
const accessKeyId = core.getInput('access-key-id', inputOptions);
|
|
||||||
const accessKeySecret = core.getInput('access-key-secret', inputOptions);
|
|
||||||
const stsToken = core.getInput('sts-token');
|
|
||||||
const args = [
|
|
||||||
'config',
|
|
||||||
'--endpoint',
|
|
||||||
endpoint,
|
|
||||||
'--access-key-id',
|
|
||||||
accessKeyId,
|
|
||||||
'--access-key-secret',
|
|
||||||
accessKeySecret
|
|
||||||
];
|
|
||||||
if (stsToken) {
|
|
||||||
args.push('--sts-token', stsToken);
|
|
||||||
}
|
|
||||||
const exitCode = await exec.exec('ossutil', args);
|
|
||||||
if (exitCode === 0) {
|
|
||||||
core.info('ossutil config is done');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// Fail the workflow run if an error occurs
|
// Fail the workflow run if an error occurs
|
||||||
@@ -32974,6 +32950,40 @@ async function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
|
async function install() {
|
||||||
|
const version = core.getInput('ossutil-version', { required: true });
|
||||||
|
await installer.installOssutil(version);
|
||||||
|
core.info('ossutil is successfully installed');
|
||||||
|
}
|
||||||
|
async function config() {
|
||||||
|
const endpoint = core.getInput('endpoint');
|
||||||
|
if (endpoint.length == 0) {
|
||||||
|
core.info('ossutil config is skipped');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const accessKeyId = core.getInput('access-key-id', { required: true });
|
||||||
|
const accessKeySecret = core.getInput('access-key-secret', { required: true });
|
||||||
|
const args = [
|
||||||
|
'config',
|
||||||
|
'--endpoint',
|
||||||
|
endpoint,
|
||||||
|
'--access-key-id',
|
||||||
|
accessKeyId,
|
||||||
|
'--access-key-secret',
|
||||||
|
accessKeySecret
|
||||||
|
];
|
||||||
|
const stsToken = core.getInput('sts-token');
|
||||||
|
if (stsToken) {
|
||||||
|
args.push('--sts-token', stsToken);
|
||||||
|
}
|
||||||
|
const exitCode = await exec.exec('ossutil', args);
|
||||||
|
if (exitCode === 0) {
|
||||||
|
core.info('ossutil config is done');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.error('ossutil config is failed with exit code: ' + exitCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
66
src/main.ts
66
src/main.ts
@@ -8,35 +8,47 @@ import * as installer from './installer'
|
|||||||
*/
|
*/
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// download
|
install()
|
||||||
const version = core.getInput('ossutil-version')
|
config()
|
||||||
await installer.installOssutil(version)
|
|
||||||
core.info('ossutil is successfully installed')
|
|
||||||
|
|
||||||
// config
|
|
||||||
const inputOptions: core.InputOptions = { required: true }
|
|
||||||
const endpoint = core.getInput('endpoint', inputOptions)
|
|
||||||
const accessKeyId = core.getInput('access-key-id', inputOptions)
|
|
||||||
const accessKeySecret = core.getInput('access-key-secret', inputOptions)
|
|
||||||
const stsToken = core.getInput('sts-token')
|
|
||||||
const args = [
|
|
||||||
'config',
|
|
||||||
'--endpoint',
|
|
||||||
endpoint,
|
|
||||||
'--access-key-id',
|
|
||||||
accessKeyId,
|
|
||||||
'--access-key-secret',
|
|
||||||
accessKeySecret
|
|
||||||
]
|
|
||||||
if (stsToken) {
|
|
||||||
args.push('--sts-token', stsToken)
|
|
||||||
}
|
|
||||||
const exitCode = await exec.exec('ossutil', args)
|
|
||||||
if (exitCode === 0) {
|
|
||||||
core.info('ossutil config is done')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Fail the workflow run if an error occurs
|
// Fail the workflow run if an error occurs
|
||||||
if (error instanceof Error) core.setFailed(error.message)
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function install(): Promise<void> {
|
||||||
|
const version = core.getInput('ossutil-version', { required: true })
|
||||||
|
await installer.installOssutil(version)
|
||||||
|
core.info('ossutil is successfully installed')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function config(): Promise<void> {
|
||||||
|
const endpoint = core.getInput('endpoint')
|
||||||
|
if (endpoint.length === 0) {
|
||||||
|
core.info('ossutil config is skipped')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const accessKeyId = core.getInput('access-key-id', { required: true })
|
||||||
|
const accessKeySecret = core.getInput('access-key-secret', { required: true })
|
||||||
|
const args = [
|
||||||
|
'config',
|
||||||
|
'--endpoint',
|
||||||
|
endpoint,
|
||||||
|
'--access-key-id',
|
||||||
|
accessKeyId,
|
||||||
|
'--access-key-secret',
|
||||||
|
accessKeySecret
|
||||||
|
]
|
||||||
|
const stsToken = core.getInput('sts-token')
|
||||||
|
if (stsToken) {
|
||||||
|
args.push('--sts-token', stsToken)
|
||||||
|
}
|
||||||
|
|
||||||
|
const exitCode = await exec.exec('ossutil', args)
|
||||||
|
if (exitCode === 0) {
|
||||||
|
core.info('ossutil config is done')
|
||||||
|
} else {
|
||||||
|
core.error(`ossutil config is failed with exit code: ${exitCode}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user