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

Env variable NO_WINDOWS_SERVICE to force interactive mode on Windows #254

Merged

Conversation

mateuszrzeszutek
Copy link
Contributor

This is a copy of the main repo PR: open-telemetry/opentelemetry-collector#2272 that enables running the collector inside Windows Docker containers.

Main repo PR description:

Adding a feature - adds a check for NO_WINDOWS_SERVICE environment variable on Windows to allow forcing interactive mode instead of running as a service.

This is required for using the collector in Windows Docker containers, as at least some of the Windows base images do not support services (fails with "The service process could not connect to the service controller"). Environment variable is used instead of automatic detection of Docker as it is uncertain if images that support services are possible and/or desired.

Running collector in Windows Docker containers is required to perform containerized integration tests of agents on Windows.

We want to use splunk-otel-collector in our splunk-otel-java smoke-tests, and that includes Windows tests. This change is required to make Windows containers work.

This is a copy of the main repo PR: open-telemetry/opentelemetry-collector#2272 that enables running the collector inside Windows Docker containers.

Main repo PR description:

> Adding a feature - adds a check for NO_WINDOWS_SERVICE environment variable on Windows to allow forcing interactive mode instead of running as a service.
>
> This is required for using the collector in Windows Docker containers, as at least some of the Windows base images do not support services (fails with "The service process could not connect to the service controller"). Environment variable is used instead of automatic detection of Docker as it is uncertain if images that support services are possible and/or desired.
>
>Running collector in Windows Docker containers is required to perform containerized integration tests of agents on Windows.

We want to use splunk-otel-collector in our splunk-otel-java
smoke-tests, and that includes Windows tests. This change is required
to make Windows containers work.
@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #254 (9d02851) into main (15c02c2) will decrease coverage by 0.65%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
- Coverage   87.55%   86.90%   -0.66%     
==========================================
  Files          19       19              
  Lines        1463     1474      +11     
==========================================
  Hits         1281     1281              
- Misses        147      158      +11     
  Partials       35       35              
Impacted Files Coverage Δ
cmd/otelcol/main_windows.go 0.00% <0.00%> (ø)

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 15c02c2...9d02851. Read the comment docs.

// than 0, use interactive mode instead of running as a service. This should
// be set in case running as a service is not possible or desired even
// though the current session is not detected to be interactive
if value, present := os.LookupEnv("NO_WINDOWS_SERVICE"); present && value != "0" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunate there's a double negative ("no" & 0) as opposed to something like WINDOWS_INTERACTIVE, but deviating may not be desired...

@rmfitzpatrick
Copy link
Contributor

Would you mind opening an issue for adding an integration test for this? We have a windows test env that would be adequate but none of the integration tests are enabled in CI yet.

You of course could also add an integration test in this PR if you wanted ;)

@mateuszrzeszutek
Copy link
Contributor Author

I'll create an issue for that 😄

@rmfitzpatrick rmfitzpatrick merged commit 21e426b into signalfx:main Apr 8, 2021
@mateuszrzeszutek mateuszrzeszutek deleted the no-windows-service-env-var branch April 9, 2021 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants