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

(maint) Turn off analytics submissions #3294

Merged
merged 4 commits into from
Apr 8, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/docker_setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ runs:
- name: Bring up containers
shell: bash
run: |
sudo apt install docker-compose
docker-compose -f spec/docker-compose.yml build --parallel
docker-compose -f spec/docker-compose.yml up -d
1 change: 1 addition & 0 deletions .github/actions/sudo_setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ runs:
- name: Bring up containers
shell: bash
run: |
sudo apt install docker-compose
docker-compose -f spec/docker-compose.yml build --parallel
docker-compose -f spec/docker-compose.yml up -d
- name: Create non-sudo user
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ jobs:
- name: Run DITA
uses: dita-ot/dita-ot-action@master
with:
dita-ot-version: 4.1.2
build: dita -i documentation/bolt.ditamap -o out -f html5 --processing-mode=strict
5 changes: 3 additions & 2 deletions documentation/analytics.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Analytics

Bolt collects data about how you use it to help the Bolt team make decisions
about how to improve it. You can opt out of providing this data.
about how to improve it. You can opt out of providing this data. Analytics is
disabled by default.

## Opt out of data collection

Expand All @@ -12,7 +13,7 @@ or by setting an environment variable.

To disable data collection, set `analytics: false` in your [configuration
file](configuring_bolt.md). This option is supported in the system-wide,
user-level, and project configuration files.
user-level, and project configuration files. `false` is the default value.

```yaml
# bolt-defaults.yaml
Expand Down
4 changes: 0 additions & 4 deletions documentation/bolt_installing.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Installing Bolt

> Bolt automatically collects data about how you use it. If you want to opt
> out of providing this data, you can do so. For more information, see
> [Opt out of data collection](analytics.md#opt-out-of-data-collection).

Packaged versions of Bolt are available for several Linux distributions, macOS,
and Microsoft Windows.

Expand Down
2 changes: 1 addition & 1 deletion lib/bolt/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def initialize(project, config_data, overrides = {})
@config_files = []

default_data = {
'analytics' => true,
'analytics' => false,
'apply-settings' => {},
'color' => true,
'compile-concurrency' => Etc.nprocessors,
Expand Down
22 changes: 13 additions & 9 deletions lib/bolt/shell/powershell/snippets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,25 @@ def run_script(arguments, script_path)
}
#{build_arg_list}

switch -regex ( Get-ExecutionPolicy )
try
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mcdonaldseanp I think the path is messed up for module loading in our test runners:

       +"merged_output" => "Get-ExecutionPolicy : The 'Get-ExecutionPolicy' command was found in the module 'Microsoft.PowerShell.Security', but \r\nthe module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Security'.\r\nAt line:10 char:17\r\n+ switch -regex ( Get-ExecutionPolicy )\r\n+                 ~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : ObjectNotFound: (Get-ExecutionPolicy:String) [], CommandNotFoundException\r\n    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule\r\n \r\nparam\n",

I think that the intent of this was simply to provide a helpful error message and that we should not error if we cant load that module. In practice i doubt this comes up much because task running all works due to other powershell setup we do.

Do you think a catch here is reasonable, should it be more specific on objects it catches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#2659 for reference

{
'^AllSigned'
switch -regex ( Get-ExecutionPolicy )
{
if ((Get-AuthenticodeSignature -File "#{script_path}").Status -ne 'Valid') {
$Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} and script '#{script_path}' does not contain a valid signature.")
'^AllSigned'
{
if ((Get-AuthenticodeSignature -File "#{script_path}").Status -ne 'Valid') {
$Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} and script '#{script_path}' does not contain a valid signature.")
exit 1;
}
}
'^Restricted'
{
$Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} which denies running any scripts on the target.")
exit 1;
}
}
'^Restricted'
{
$Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} which denies running any scripts on the target.")
exit 1;
}
}
catch {}

if([string]::IsNullOrEmpty($invokeArgs.ScriptBlock)){
$Host.UI.WriteErrorLine("Error: Failed to obtain scriptblock from '#{script_path}'. Running scripts might be disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170");
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@
end

context 'analytics' do
it 'defaults to enabled' do
expect(config.analytics).to eq(true)
it 'defaults to disabled' do
expect(config.analytics).to eq(false)
end

it 'overrides a true value with false' do
Expand Down
Loading