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

Added build step for generating Windows MSI #1153

Merged
merged 1 commit into from
Jul 7, 2020

Conversation

james-bebbington
Copy link
Member

@james-bebbington james-bebbington commented Jun 22, 2020

Link to tracking Issue:
#1125

Description:
Added commands & build steps to generate an MSI.

  • Running .\scripts\make.ps1 New-MSI -Config "./path/to/conf.yaml" will create an MSI packaged with the specified config file. If the -Config argument is not provided, the default config file in examples/otel-local-config.yaml will be used.
  • An MSI with the default config will be published as a release artifact.

Users are able to override the config when installing the MSI by passing in a different config file path as an argument, i.e.

msiexec /i opentelemetry-collector.msi CONFIG=path/to/conf.yaml

If the user specifies a custom config file, and that file can't be found, they will get a generic popup error. The MSI logs will report "CustomAction CopyConfig returned actual error code 4" which is a pretty mediocre error message, but at least points to the error.

(once this gets merged, I'll create a similar PR in Contrib)

@codecov
Copy link

codecov bot commented Jun 22, 2020

Codecov Report

Merging #1153 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1153      +/-   ##
==========================================
- Coverage   88.08%   88.06%   -0.03%     
==========================================
  Files         203      203              
  Lines       14658    14658              
==========================================
- Hits        12912    12908       -4     
- Misses       1309     1311       +2     
- Partials      437      439       +2     
Impacted Files Coverage Δ
translator/internaldata/resource_to_oc.go 83.72% <0.00%> (-4.66%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12b3d9c...3ad05c4. Read the comment docs.

Copy link
Member Author

@james-bebbington james-bebbington left a comment

Choose a reason for hiding this comment

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

I need a bit of guidance with this PR. Please see the questions below:

  1. When should this step run? Shall we set this up similarly to the publish-dev & publish-stable steps? (can't be combined into the same steps as will need to run under a diff executor unfortunately)
  2. Where should we store the generated MSI? Afaik, there isn't really any standard package manager for storing MSIs. Is storing it as a release artifact enough? That would mean we only run this on publish-stable. Should we run a step to create the MSI on merge anyway, so we find out sooner if this somehow gets broken?
  3. Also see question below re Makefile

@jrcamp @owais

name: Install Wix Toolset
command: |
choco install wixtoolset
setx /m PATH "%PATH%;C:\Program Files (x86)\WiX Toolset v3.11\bin"
Copy link
Member Author

Choose a reason for hiding this comment

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

Annoyingly we have to do this because the choco package doesn't take care of it for us: https://chocolatey.org/packages/wixtoolset#comment-3471097677

Makefile Outdated Show resolved Hide resolved
@james-bebbington james-bebbington changed the title [WIP] Added build step for generating Windows MSI Added build step for generating Windows MSI Jun 26, 2020
@james-bebbington james-bebbington marked this pull request as ready for review June 26, 2020 02:40
@jrcamp
Copy link
Contributor

jrcamp commented Jun 26, 2020

I need a bit of guidance with this PR. Please see the questions below:

  1. When should this step run? Shall we set this up similarly to the publish-dev & publish-stable steps? (can't be combined into the same steps as will need to run under a diff executor unfortunately)
  2. Where should we store the generated MSI? Afaik, there isn't really any standard package manager for storing MSIs. Is storing it as a release artifact enough? That would mean we only run this on publish-stable. Should we run a step to create the MSI on merge anyway, so we find out sooner if this somehow gets broken?
  3. Also see question below re Makefile

Do workspaces persist across executor types? I forget. If so then maybe you can add windows-msi to requires of publish-stable? And in the job store the msi using store_artifacts?

That would mean we only run this on publish-stable. Should we run a step to create the MSI on merge anyway, so we find out sooner if this somehow gets broken?

Not sure what you mean by this. It was run as part of the circleci job in this PR for instance even though it's not part of publish-stable right?

@jrcamp
Copy link
Contributor

jrcamp commented Jun 26, 2020

btw would be nice to get into chocolatey repo (@jchengsfx did it for smart agent recently)

@tigrannajaryan tigrannajaryan added this to In progress in Collector via automation Jun 26, 2020
Copy link
Contributor

@jchengsfx jchengsfx left a comment

Choose a reason for hiding this comment

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

@james-bebbington Let's rename the scripts/msi/ directory to packaging/msi/, move make.ps1 to packaging/msi/, and update the paths in the files accordingly.

@jrcamp
Copy link
Contributor

jrcamp commented Jun 29, 2020

@james-bebbington I think it's fine to build msi on every build. Like you say we don't want to find out it's broken after we make a release. It should happen in parallel to other things like running tests so I don't think it should make the build much longer.

@james-bebbington
Copy link
Member Author

@james-bebbington Let's rename the scripts/msi/ directory to packaging/msi/, move make.ps1 to packaging/msi/, and update the paths in the files accordingly.

Cool - all done

btw would be nice to get into chocolatey repo (@jchengsfx did it for smart agent recently)

I'll see how I go for time. Would be nice to add this, but we likely won't need it as we have another package manager for Windows on GCP.

@james-bebbington james-bebbington force-pushed the windows-msi branch 4 times, most recently from cfb43a7 to 9c19105 Compare June 30, 2020 07:44
Collector automation moved this from In progress to Review in progress Jun 30, 2020
function New-MSI(
[string]$Config="./examples/otel-local-config.yaml"
) {
$Version = If($env:VERSION) { $env:VERSION } else { "0.0.1" }
Copy link
Contributor

@jchengsfx jchengsfx Jun 30, 2020

Choose a reason for hiding this comment

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

We should also set VERSION to the CIRCLE_TAG env var (if it exists and matches \d+\.\d+\.\d+, without the v) for release builds.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done - since we're referring to a CircleCI specific env variable, I moved this code into the CircleCI config file.

Minor note: MSI Product Version only supports the regex format you specified (e.g. 0.0.1). The tag filter we use to determine when to publish releases allows additional characters at the end (e.g. v0.0.1-alpha). If we see a tag like that I've opted to just ignore the extra chars.

@james-bebbington james-bebbington force-pushed the windows-msi branch 4 times, most recently from a900b7f to 28f3ec8 Compare July 1, 2020 05:39
@@ -73,7 +73,7 @@ workflows:
only: /^v([0-9])+.([0-9])+.([0-9])+.*/
- cross-compile:
requires:
- build
- setup-and-lint
Copy link
Member Author

Choose a reason for hiding this comment

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

@owais

I think this PR is ready to be merged, however, should I make the same change here as you made in https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/384/files and replace build with cross-compile? (I had changed this dependency to speed up the overall build time since this PR adds another step that's dependent on cross-compile)

@james-bebbington
Copy link
Member Author

I'm very keen to merge this one soon if anyone is able to take another look

Collector automation moved this from Review in progress to Reviewer approved Jul 7, 2020
@bogdandrutu bogdandrutu merged commit db02bc3 into open-telemetry:master Jul 7, 2020
Collector automation moved this from Reviewer approved to Done Jul 7, 2020
wyTrivail pushed a commit to mxiamxia/opentelemetry-collector that referenced this pull request Jul 13, 2020
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this pull request Nov 11, 2021
…o the spec (open-telemetry#1153)

* Rename ParentOrElse to ParentBased and enhance it according to the spec

- Renaming of type and sampler function
- Enhancing ParentBased with sampler options
- Set default samplers for each applicable parent-based case
- Adjust ShouldSample(...) func accordingly

* Adjust existing tests for ParentBased and add new ones

- add tests for ParentBased sampler options and description
- renaming in trace_test.go

* Update CHANGELOG.md

* PR feedback

- More clearer naming of structs; add comments where missing
- Adhere to the configuration style guide

* PR feedback - punctuation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Collector
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants