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

Integration tests: Parse agent version from version.go #6611

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

pazone
Copy link
Contributor

@pazone pazone commented Jan 27, 2025

What does this PR do?

The way how we defined the agent version for integration tests wasn't reliable. It works correctly on the main branch but might work incorrectly on 8.17. That blocks the backports to 8.17 and 8.16. The new approach parses version.go.

  • Modified integration test scripts
  • The regexes will be replaced and simplified when this issue is done

Why is it important?

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

How to test this PR locally

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@pazone pazone added enhancement New feature or request skip-changelog Team:Ingest-EngProd backport-8.x Automated backport to the 8.x branch with mergify labels Jan 27, 2025
@pazone pazone requested review from cmacknz and blakerouse January 27, 2025 14:48
@pazone pazone requested review from a team as code owners January 27, 2025 14:48
@mergify mergify bot assigned pazone Jan 27, 2025
@pazone pazone marked this pull request as draft January 28, 2025 09:58
@pazone pazone marked this pull request as ready for review January 28, 2025 20:46
@pazone pazone changed the title Integration tests: use the mage target to get agent version Integration tests: Parse agent version from version.go Jan 28, 2025
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Comment on lines +33 to +37
# Parsing version.go. Will be simplified here: https://github.com/elastic/ingest-dev/issues/4925
AGENT_VERSION=$(grep "const defaultBeatVersion =" version/version.go | cut -d\" -f2)
AGENT_VERSION="${AGENT_VERSION}-SNAPSHOT"
export AGENT_VERSION
echo "~~~ Agent version: ${AGENT_VERSION}"
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@pazone pazone Jan 29, 2025

Choose a reason for hiding this comment

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

What is the second place? If it's the PS file for Windows then unfortunately it's hard to avoid(Possible but the solution is controversial).
I also added a comment above(in the code). The mentioned issue will replace it with AGENT_VERSION=$(cat .agent-version).
I would like to ask you a QQ about your example if you don't mind. Wouldn't it be easier to create a similar .version file and embed it to the version.go? Then getting the version will be as simple as it mentioned above

Copy link
Member

Choose a reason for hiding this comment

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

What is the second place? If it's the PS file for Windows then unfortunately it's hard to avoid(Possible but the solution is controversial).

Yep

Wouldn't it be easier to create a similar .version file and embed it to the version.go?

I think so, thanks for bringing this to my attention, if there is a plan, then all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify enhancement New feature or request skip-changelog Team:Ingest-EngProd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants