Skip to content
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

Improve release default value #325

Merged
merged 5 commits into from Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ package.xml
.idea
.php_cs.cache
docs/_build
var
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Unreleased
- ...

## 3.4.4 (2020-03-16)
- Improve `release` option default value (#325)

## 3.4.3 (2020-02-03)
- Change default of `in_app_include` to empty, due to getsentry/sentry-php#958 (#311)
- Improve class_alias robustness (#315)
Expand Down
1 change: 0 additions & 1 deletion composer.json
Expand Up @@ -21,7 +21,6 @@
"require": {
"php": "^7.1",
"jean85/pretty-package-versions": "^1.0",
"ocramius/package-versions": "^1.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removal seems wrong, as the code is still depending directly on \PackageVersions\Versions::ROOT_PACKAGE_NAME in src/DependencyInjection/Configuration.php

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, a composer-checker run would have spotted that. BTW this will not break the app since that is an implicit dependency of jean85/pretty-package-versions.

"sentry/sdk": "^2.1",
"symfony/config": "^3.4||^4.0||^5.0",
"symfony/console": "^3.4||^4.0||^5.0",
Expand Down
3 changes: 2 additions & 1 deletion src/DependencyInjection/Configuration.php
Expand Up @@ -2,6 +2,7 @@

namespace Sentry\SentryBundle\DependencyInjection;

use Jean85\PrettyVersions;
use PackageVersions\Versions;
use Sentry\Options;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
Expand Down Expand Up @@ -111,7 +112,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->prototype('scalar');
$optionsChildNodes->scalarNode('project_root');
$optionsChildNodes->scalarNode('release')
->defaultValue(Versions::getVersion(Versions::ROOT_PACKAGE_NAME))
->defaultValue(PrettyVersions::getVersion(Versions::ROOT_PACKAGE_NAME)->getPrettyVersion())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still going to lead to trackable hashes in sentry? The previous version kinda did

Copy link
Collaborator Author

@Jean85 Jean85 Mar 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the behavior, from the readme:

if the requested package is a tagged version, it will return just the short version; if not, [...] it will return the version of the package, followed by the short version of the commit hash (i.e. 6.0.0@fa5711)

[EDIT] The short version is just the tag.

So, it should.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jean85 most software is released via rolling master or such directly, so it will likely be dev-master@abcdef

If sentry can work with that, we should be OK, just wanted to make sure of that.

->info('Release version to be reported to sentry, see https://docs.sentry.io/workflow/releases/?platform=php')
->example('my/application@ff11bb');
$optionsChildNodes->floatNode('sample_rate')
Expand Down
4 changes: 2 additions & 2 deletions test/DependencyInjection/ConfigurationTest.php
Expand Up @@ -2,7 +2,7 @@

namespace Sentry\SentryBundle\Test\DependencyInjection;

use PackageVersions\Versions;
use Jean85\PrettyVersions;
use Sentry\Options;
use Sentry\SentryBundle\DependencyInjection\Configuration;
use Sentry\SentryBundle\Test\BaseTestCase;
Expand Down Expand Up @@ -63,7 +63,7 @@ public function testConfigurationDefaults(): void
'excluded_exceptions' => [],
'prefixes' => $defaultSdkValues->getPrefixes(),
'tags' => [],
'release' => Versions::getVersion('sentry/sentry-symfony'),
'release' => PrettyVersions::getVersion('sentry/sentry-symfony')->getPrettyVersion(),
],
'monolog' => [
'error_handler' => [
Expand Down
2 changes: 1 addition & 1 deletion test/DependencyInjection/SentryExtensionTest.php
Expand Up @@ -63,7 +63,7 @@ public function testOptionsDefaultValues(): void

$this->assertNull($options->getDsn());
$this->assertSame('test', $options->getEnvironment());
$this->assertSame([realpath('./var/cache'), '/dir/project/root/vendor'], $options->getInAppExcludedPaths());
$this->assertSame([$container->getParameter('kernel.cache_dir'), '/dir/project/root/vendor'], $options->getInAppExcludedPaths());

$this->assertSame(1, $container->getParameter('sentry.listener_priorities.request'));
$this->assertSame(1, $container->getParameter('sentry.listener_priorities.sub_request'));
Expand Down
1 change: 0 additions & 1 deletion var/cache/.gitignore

This file was deleted.