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

Fixing script to read ascii code #3556

Merged
merged 5 commits into from
Oct 23, 2023
Merged

Fixing script to read ascii code #3556

merged 5 commits into from
Oct 23, 2023

Conversation

gizas
Copy link
Contributor

@gizas gizas commented Oct 6, 2023

-- Bug

What does this PR do?

WHAT: Updates makefile to read from different value of version.doc file
WHY: The doc-branch is a field that no longer is udpated. Thus we replace it with stack-version field

Why is it important?

To avoid wrong references to main and alwasy reference to latest release of templates

Checklist

  • 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

How to test this PR locally

  1. Checkout PR
  2. cd elastic-agent/deploy/kubernetes
  3. Run make make generate-k8s

See in elastic-agent-standalone-kubernetes.yaml

      #        wget -O - https://github.com/elastic/elastic-agent/archive/8.8.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-8.8/deploy/kubernetes/elastic-agent-standalone/templates.d"

@gizas gizas requested a review from a team as a code owner October 6, 2023 13:25
@mergify mergify bot assigned gizas Oct 6, 2023
@mergify
Copy link
Contributor

mergify bot commented Oct 6, 2023

This pull request does not have a backport label. Could you fix it @gizas? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip label Oct 6, 2023
@gizas
Copy link
Contributor Author

gizas commented Oct 6, 2023

@cmacknz I move our discussion here: #3523 (comment)

Only thing is that stack-version still seems not updated in main branch. See here: https://github.com/elastic/elastic-agent/blob/main/version/docs/version.asciidoc#L1

Is this expected?

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 6, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-10-20T05:41:06.456+0000

  • Duration: 33 min 9 sec

Test stats 🧪

Test Results
Failed 0
Passed 6577
Skipped 59
Total 6636

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -1,7 +1,7 @@
ALL=elastic-agent-standalone elastic-agent-managed

BEAT_VERSION=$(shell grep '^:stack-version:' ../../version/docs/version.asciidoc | cut -c 17- )
BRANCH_VERSION=$(shell grep '^:doc-branch:' ../../version/docs/version.asciidoc | cut -c 14- )
Copy link
Member

@cmacknz cmacknz Oct 6, 2023

Choose a reason for hiding this comment

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

It appears the :stack-version key here isn't being updated properly since this shouldn't be 8.8.

The one you want and is guarnateed to be right is

const defaultBeatVersion = "8.12.0"

There are a couple of examples for parsing this you could reuse. For one example see

BEAT_VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' "${WORKSPACE}/version/version.go")

You'd still have to drop the patch version.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I also now see why we were trying to use doc-branch because this needs to be main and not 8.12 for main.

I would suggest git branch --show-current but that will break when this is run on developer branches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to read from version.go

Both managed and standalone updated

@@ -683,7 +683,7 @@ spec:
# - -c
# - >-
# mkdir -p /etc/elastic-agent/inputs.d &&
# wget -O - https://github.com/elastic/elastic-agent/archive/main.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-main/deploy/kubernetes/elastic-agent-standalone/templates.d"
# wget -O - https://github.com/elastic/elastic-agent/archive/8.8.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-8.8/deploy/kubernetes/elastic-agent-standalone/templates.d"
Copy link
Member

Choose a reason for hiding this comment

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

All of the files probably should have updated, not just one.

@gizas
Copy link
Contributor Author

gizas commented Oct 19, 2023

/test

@gizas
Copy link
Contributor Author

gizas commented Oct 19, 2023

Do you have any idea why the check fails in https://fleet-ci.elastic.co/blue/organizations/jenkins/elastic-agent%2Felastic-agent-mbp/detail/PR-3556/4/pipeline ?

   #        mkdir -p /etc/elastic-agent/inputs.d &&

[2023-10-19T13:50:42.860Z] -      #        wget -O - https://github.com/elastic/elastic-agent/archive/8.12.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-8.12/deploy/kubernetes/elastic-agent-standalone/templates.d"

[2023-10-19T13:50:42.860Z] +      #        wget -O - https://github.com/elastic/elastic-agent/archive/.tar.gz | tar xz -C /etc/elastic-agent/inputs.d --strip=5 "elastic-agent-/deploy/kubernetes/elastic-agent-standalone/templates.d"

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 19, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.824% (84/85) 👍
Files 67.105% (204/304) 👍
Classes 66.19% (370/559) 👍
Methods 53.583% (1174/2191) 👍
Lines 39.805% (13770/34594) 👍 0.003
Conditionals 100.0% (0/0) 💚

@gizas
Copy link
Contributor Author

gizas commented Oct 20, 2023

/test

@elastic-sonarqube
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@gizas gizas merged commit 3d7b3c1 into main Oct 23, 2023
8 checks passed
@gizas gizas deleted the fixingmakefile branch October 23, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants