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

action: bump apm-agent-go version #81

Merged
merged 12 commits into from
Jan 31, 2023
Merged

action: bump apm-agent-go version #81

merged 12 commits into from
Jan 31, 2023

Conversation

v1v
Copy link
Member

@v1v v1v commented Jan 30, 2023

What

This will not depend on the APM Agent Go pipeline

But it will use the updatecli tool to search for new versions and update them

Why

As Jenkins was somehow centralised then it was certainly possible to create pipeline/downstreams connections, as we are transitioning to GH actions it makes sense to use a different paradigm when bumping versions.

A similar implementation was done for the apm-agent-node and its opbeans-node project in elastic/opbeans-node#179

Test

I created a branch based on this one and downgraded the Agent version to 2.1.0:

GITHUB_TOKEN=*****
GIT_EMAIL=*** \
GIT_USER=**** \
updatecli diff --config .ci/bump-opbeans-go.yml --debug 


+++++++++++
+ PREPARE +
+++++++++++

Loading Pipeline ".ci/bump-opbeans-go.yml"

SCM repository retrieved: 1
DEBUG: stage: git-clone

DEBUG: cloning git repository: https://github.com/elastic/opbeans-go.git in /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/opbeans-go
DEBUG: 
DEBUG: fetching remote branches
DEBUG: stage: git-checkout

DEBUG: checkout branch "updatecli_5501fcc282d237746a0701d69ba7300637d3ccbd027efab3b94bd4d896fcd824", based on "main" to directory "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/opbeans-go"
DEBUG: 
DEBUG: No remote name "updatecli_5501fcc282d237746a0701d69ba7300637d3ccbd027efab3b94bd4d896fcd824"


++++++++++++++++++
+ AUTO DISCOVERY +
++++++++++++++++++



++++++++++++
+ PIPELINE +
++++++++++++



#########################################
# BUMP ELASTIC-APM-GO TO LATEST VERSION #
#########################################


SOURCES
=======

elastic-apm-go
--------------
DEBUG: Environment variables
DEBUG: 	* PATH=/Users/vmartinez/bin:/usr/local/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/vmartinez/bin:/Users/vmartinez/.sdkman/candidates/java/current/bin:/Users/vmartinez/.nvm/versions/node/v14.17.5/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/vmartinez/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
DEBUG: 	* UPDATECLI_PIPELINE_STAGE=source
The shell 🐚 command "bash .ci/get-latest-version.sh" ran successfully with the following output:
----
v2.2.0
----
DEBUG: command stderr output was:
----
----
DEBUG: empty changelog found for the source


CONDITIONS:
===========

elastic-apm-go-version-check
----------------------------
DEBUG: Environment variables
DEBUG: 	* PATH=/Users/vmartinez/bin:/usr/local/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/vmartinez/bin:/Users/vmartinez/.sdkman/candidates/java/current/bin:/Users/vmartinez/.nvm/versions/node/v14.17.5/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/vmartinez/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
DEBUG: 	* UPDATECLI_PIPELINE_STAGE=condition
The shell 🐚 command "bash .ci/test-version.sh v2.2.0" ran successfully with the following output:
----
----
DEBUG: command stderr output was:
----
----


TARGETS
========

go.sum
------

**Dry Run enabled**

DEBUG: stage: git-checkout

DEBUG: checkout branch "updatecli_5501fcc282d237746a0701d69ba7300637d3ccbd027efab3b94bd4d896fcd824", based on "main" to directory "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/opbeans-go"
DEBUG: 
DEBUG: No remote name "updatecli_5501fcc282d237746a0701d69ba7300637d3ccbd027efab3b94bd4d896fcd824"
DEBUG: Environment variables
DEBUG: 	* PATH=/Users/vmartinez/bin:/usr/local/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/vmartinez/bin:/Users/vmartinez/.sdkman/candidates/java/current/bin:/Users/vmartinez/.nvm/versions/node/v14.17.5/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/vmartinez/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
DEBUG: 	* UPDATECLI_PIPELINE_STAGE=target
DEBUG: 	* DRY_RUN=true
The shell 🐚 command "bash .ci/go-install-elastic-apm-go.sh v2.2.0" exited on error (exit code 127) with the following output:
----
----

command stderr output was:
----
bash: .ci/go-install-elastic-apm-go.sh: No such file or directory

----

dockerfile
----------

**Dry Run enabled**

DEBUG: stage: git-checkout

DEBUG: checkout branch "updatecli_5501fcc282d237746a0701d69ba7300637d3ccbd027efab3b94bd4d896fcd824", based on "main" to directory "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/opbeans-go"
DEBUG: 
DEBUG: No remote name "updatecli_5501fcc282d237746a0701d69ba7300637d3ccbd027efab3b94bd4d896fcd824"
DEBUG: Relative path detected: changing to absolute path from SCM: "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/opbeans-go/Dockerfile"
✔ Content from file "/var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/github/elastic/opbeans-go/Dockerfile" already up to date
✔ All contents from 'file' and 'files' combined already up to date

ERROR: something went wrong in target "go.sum" : "Shell command exited on error."

Pipeline "Bump elastic-apm-go to latest version" failed
Skipping due to:
	targets stage:	"something went wrong during target execution"

=============================

REPORTS:


✗ Bump elastic-apm-go to latest version:
	Source:
		✔ [elastic-apm-go] Get latest elastic-apm-go version (kind: shell)
	Condition:
		✔ [elastic-apm-go-version-check] Check if installed version differs (kind: shell)
	Target:
		✔ [dockerfile] Set org.label-schema.version in Dockerfile (kind: file)
		✗ [go.sum] Install new elastic-apm-go go dependency version (kind: shell)


Run Summary
===========
Pipeline(s) run:
  * Changed:	0
  * Failed:	1
  * Skipped:	0
  * Succeeded:	0
  * Total:	1
ERROR: ✗ 1 over 1 pipeline failed
ERROR: command failed

bash: .ci/go-install-elastic-apm-go.sh: No such file or directory is caused since it uses the main branch where to apply the changes, update-cli checkout the repo and then apply the changes.

If I run .ci/go-install-elastic-apm-go.sh v2.2.0 then it works, if no changes to be appllied

.ci/go-install-elastic-apm-go.sh v2.1.0
go: warning: github.com/mattn/go-sqlite3@v2.0.3+incompatible: retracted by module author: Accidental; no major changes or features.
go: to switch to the latest unretracted version, run:
	go get github.com/mattn/go-sqlite3@latest

or if changes to be applied

.ci/go-install-elastic-apm-go.sh v2.120
go: warning: github.com/mattn/go-sqlite3@v2.0.3+incompatible: retracted by module author: Accidental; no major changes or features.
go: to switch to the latest unretracted version, run:
	go get github.com/mattn/go-sqlite3@latest
go: downgraded go.elastic.co/apm/module/apmgin/v2 v2.1.0 => v2.2.0
go: downgraded go.elastic.co/apm/module/apmhttp/v2 v2.1.0 => v2.2.0
go: downgraded go.elastic.co/apm/module/apmlogrus/v2 v2.1.0 => v2.2.0
go: downgraded go.elastic.co/apm/module/apmsql/v2 v2.1.0 => v2.2.0
go: downgraded go.elastic.co/apm/v2 v2.1.0 => v2.2.0

Further details

If you wonder what's the main reason for using the update-cli tool, Ivan provided further details in one of the comments:

This wil not depend on the APM Agent Go pipeline

But it will use the updatecli tool to search for new versions and update them
@v1v v1v requested review from kuisathaverat and a team January 30, 2023 14:33
@v1v v1v self-assigned this Jan 30, 2023
@v1v v1v added automation Team:Automation Label for the Observability productivity team labels Jan 30, 2023
@v1v v1v marked this pull request as ready for review January 30, 2023 14:33
.ci/get-latest-version.sh Outdated Show resolved Hide resolved
v1v and others added 3 commits January 31, 2023 09:32
Co-authored-by: Ivan Fernandez Calvo <kuisathaverat@users.noreply.github.com>
.ci/test-version.sh Outdated Show resolved Hide resolved
@v1v v1v merged commit ec1dd7b into main Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Team:Automation Label for the Observability productivity team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants