-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/demrum 440 dsyms list command #61
Changes from 11 commits
cff578e
acf1104
7b8d627
cf512ce
2e79395
0b52db2
64469b0
a0f036b
4d3af2c
078c5b9
c4e0895
61bcb74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ import { | |
} from '../utils/inputValidations'; | ||
import { UserFriendlyError } from '../utils/userFriendlyErrors'; | ||
import { createLogger, LogLevel } from '../utils/logger'; | ||
import axios from 'axios'; | ||
import { uploadFile } from '../utils/httpUtils'; | ||
|
||
// Constants | ||
|
@@ -35,10 +36,9 @@ export const iOSCommand = new Command('iOS'); | |
const iOSUploadDescription = `This subcommand uploads the specified zipped dSYMs file. | ||
`; | ||
|
||
interface UploadiOSOptions { | ||
'file': string, | ||
'debug'?: boolean | ||
} | ||
const listdSYMsDescription = `This command retrieves and shows a list of the uploaded dSYM files. | ||
By default, it returns the last 100 dSYM files uploaded, sorted in reverse chronological order based on the upload timestamp. | ||
`; | ||
|
||
const generateUrl = (): string => { | ||
const realm = process.env.O11Y_REALM || DEFAULT_REALM; | ||
|
@@ -49,14 +49,18 @@ iOSCommand | |
.name('ios') | ||
.description('Upload and list zipped iOS symbolication files (dSYMs)'); | ||
|
||
interface UploadiOSOptions { | ||
file: string; | ||
debug?: boolean; | ||
} | ||
|
||
iOSCommand | ||
.command('upload') | ||
.showHelpAfterError(true) | ||
.usage('--file <path>') | ||
.description(iOSUploadDescription) | ||
.summary('Upload a dSYMs .zip file to the symbolication service') | ||
.requiredOption('--file <path>', 'Path to the dSYMs .zip file') | ||
.option('--debug', 'Enable debug logs') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it intentional to remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I think I want to keep that actually. |
||
.action(async (options: UploadiOSOptions) => { | ||
const logger = createLogger(options.debug ? LogLevel.DEBUG : LogLevel.INFO); | ||
|
||
|
@@ -75,9 +79,7 @@ iOSCommand | |
}; | ||
|
||
const url = generateUrl(); | ||
|
||
logger.info(`url: ${url}`); | ||
|
||
logger.info(`Preparing to upload dSYMs file: ${options.file}`); | ||
|
||
await uploadFile({ | ||
|
@@ -98,3 +100,25 @@ iOSCommand | |
} | ||
} | ||
}); | ||
|
||
|
||
iOSCommand | ||
.command('list') | ||
.summary('Retrieves list of metadata of all uploaded dSYM files') | ||
.showHelpAfterError(true) | ||
.description(listdSYMsDescription) | ||
.option('--debug', 'Enable debug logs') | ||
.action(async (options) => { | ||
const logger = createLogger(options.debug ? LogLevel.DEBUG : LogLevel.INFO); | ||
const url = `${API_BASE_URL}/${API_VERSION_STRING}/${API_PATH}`; | ||
|
||
try { | ||
logger.info('Fetching dSYM file data'); | ||
const response = await axios.get(url); | ||
logger.info('Raw Response Data:', JSON.stringify(response.data, null, 2)); | ||
} catch (error) { | ||
logger.error('Failed to fetch the list of uploaded files'); | ||
throw error; | ||
} | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Splunk Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { iOSCommand } from '../../src/commands/ios'; | ||
|
||
describe('ios command', () => { | ||
test('has multiple sub-commands', () => { | ||
expect(iOSCommand.commands.length).toBe(2); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this block needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which block? I'm seeing code that doesn't line up with a block above your comments, maybe the branch got out of sync with what's shown here(?).