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

[chore] correctly escape . characters during release preparation #10631

Merged

Conversation

mowies
Copy link
Member

@mowies mowies commented Jul 17, 2024

Description

This PR fixes an issue where the . character in a version string (e.g. 1.2.3) was interpreted by sed as any character and therefore needed to be properly escaped. This happened during the prepare-release workflow.
The version string for the current stable and current beta version strings provided at pipeline start is replaced as follows:

1.2.3 -> 1[.]2[.]3

This ensures that sed searches for the literal . character instead of interpreting it as a wildcard character.
I specifically used the [] syntax to avoid the hassle of "how many backslashes do i need until it's properly escaped?". (and that for bash and sed, which work different on different OSes anyways which makes it hard to test as well)

Link to tracking issue

Fixes #9748

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
@mowies mowies requested review from a team and jpkrohling July 17, 2024 10:58
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.30%. Comparing base (ea7270c) to head (74eb1cb).
Report is 92 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10631      +/-   ##
==========================================
- Coverage   92.36%   92.30%   -0.07%     
==========================================
  Files         386      397      +11     
  Lines       18400    18705     +305     
==========================================
+ Hits        16995    17265     +270     
- Misses       1052     1080      +28     
- Partials      353      360       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mx-psi
Copy link
Member

mx-psi commented Jul 19, 2024

Can we get the results of a test run of this script before merging it?

@mowies
Copy link
Member Author

mowies commented Jul 22, 2024

Here is the output from my test VM

Some notes:

  • My branch is not fully up to date with latest main and releases therefore I had to run it with older versions.
  • The script only ran until the git push command here for obvious reasons.
  • I removed a few go module download lines to make the output more readable.

Here is the console output:

Console Output
~/development/opentelemetry-collector$ export CANDIDATE_BETA=0.104.0
~/development/opentelemetry-collector$ export CURRENT_BETA=0.103.0
~/development/opentelemetry-collector$ ./.github/workflows/scripts/release-prepare-release.sh 
+ '[' '' == '' ']'
+ '[' 0.104.0 == '' ']'
+ CURRENT_STABLE_ESCAPED=
+ CURRENT_BETA_ESCAPED='0[.]103[.]0'
+ RELEASE_VERSION=v/v0.104.0
+ '[' '' == '' ']'
+ RELEASE_VERSION=v0.104.0
+ '[' 0.104.0 == '' ']'
+ make chlog-update VERSION=v0.104.0
go: downloading go.uber.org/multierr v1.11.0
...
lots of go downloads
...
go: downloading golang.org/x/text v0.15.0
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/chloggen -trimpath go.opentelemetry.io/build-tools/chloggen
go: downloading go.opentelemetry.io/build-tools/chloggen v0.13.0
go: downloading go.opentelemetry.io/build-tools v0.13.0
go: downloading github.com/spf13/cobra v1.8.0
go: downloading github.com/spf13/pflag v1.0.5
/home/moritz_wiesinger/development/opentelemetry-collector/.tools/chloggen update --config .chloggen/config.yaml --version v0.104.0
Finished updating /home/moritz_wiesinger/development/opentelemetry-collector/CHANGELOG.md
Finished updating /home/moritz_wiesinger/development/opentelemetry-collector/CHANGELOG-API.md
+ COMMANDS='- make chlog-update VERSION=v0.104.0'
+ git config user.name opentelemetrybot
+ git config user.email 107717825+opentelemetrybot@users.noreply.github.com
+ BRANCH=prepare-release-prs/0.104.0
+ git checkout -b prepare-release-prs/0.104.0
Switched to a new branch 'prepare-release-prs/0.104.0'
+ git add --all
+ git commit -m 'Changelog update v0.104.0'
[prepare-release-prs/0.104.0 85ddbbb90] Changelog update v0.104.0
 4 files changed, 17 insertions(+), 54 deletions(-)
 delete mode 100644 .chloggen/processorhelper-inserted-api.yaml
 delete mode 100644 .chloggen/processorhelper-inserted.yaml
+ '[' '' '!=' '' ']'
+ '[' 0.104.0 '!=' '' ']'
+ make prepare-release 'PREVIOUS_VERSION=0[.]103[.]0' RELEASE_CANDIDATE=0.104.0 MODSET=beta
Previous version 0[.]103[.]0
Preparing beta release 0.104.0
# ensure a clean branch
git diff -s --exit-code || (echo "local repository not clean"; exit 1)
# update files with new version
sed -i.bak 's/0[.]103[.]0/0.104.0/g' versions.yaml
sed -i.bak 's/0[.]103[.]0/0.104.0/g' ./cmd/builder/internal/builder/config.go
sed -i.bak 's/0[.]103[.]0/0.104.0/g' ./cmd/builder/test/core.builder.yaml
sed -i.bak 's/0[.]103[.]0/0.104.0/g' ./cmd/otelcorecol/builder-config.yaml
sed -i.bak 's/0[.]103[.]0/0.104.0/g' examples/k8s/otel-config.yaml
find . -name "*.bak" -type f -delete
# commit changes before running multimod
git add .
git commit -m "prepare release 0.104.0"
[prepare-release-prs/0.104.0 b002c375c] prepare release 0.104.0
 4 files changed, 26 insertions(+), 26 deletions(-)
make multimod-prerelease
make[1]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector'
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/multimod -trimpath go.opentelemetry.io/build-tools/multimod
go: downloading go.opentelemetry.io/build-tools/multimod v0.13.0
...
lots of go downloads
...
go: downloading golang.org/x/text v0.16.0
/home/moritz_wiesinger/development/opentelemetry-collector/.tools/multimod prerelease -s=true -b=false -v ./versions.yaml -m beta
Using versioning file ./versions.yaml
Using repo with root at /home/moritz_wiesinger/development/opentelemetry-collector

===== Module Set: beta =====
Updating versions for module set...
Updating all module versions in go.mod files...
Skipping 'go mod tidy'...
Committing changes to git with message 'Prepare beta for version v0.104.0'
Commit successful. Hash of commit: d461d85d3bc65ab89018ecba9bb0f332bcded0d8
=========
Prerelease finished successfully. Now checkout the new branch(es) and verify the changes.

Then, if necessary, commit changes and push to upstream/make a pull request.
make gotidy
make[2]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector'
make[3]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector'
Running target 'tidy' in module 'cmd/builder'
make -C cmd/builder tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/builder'
go: downloading github.com/knadh/koanf/parsers/yaml v0.1.0
go: downloading github.com/knadh/koanf/providers/env v0.1.0
go: downloading github.com/knadh/koanf/providers/file v0.1.0
go: downloading github.com/knadh/koanf/v2 v2.1.1
go: downloading github.com/spf13/cobra v1.8.1
go: downloading github.com/knadh/koanf/providers/fs v0.1.0
go: downloading github.com/knadh/koanf/maps v0.1.1
go: downloading github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1
go: downloading github.com/mitchellh/copystructure v1.2.0
go: downloading golang.org/x/sys v0.14.0
go: downloading github.com/mitchellh/reflectwalk v1.0.2
rm -fr go.sum
go mod tidy -compat=1.21.0
go: downloading go.uber.org/goleak v1.3.0
go: downloading github.com/inconshreveable/mousetrap v1.1.0
go: downloading gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
go: downloading github.com/kr/pretty v0.3.1
go: downloading github.com/rogpeppe/go-internal v1.10.0
go: downloading github.com/kr/text v0.2.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/builder'
Running target 'tidy' in module 'cmd/mdatagen'
make -C cmd/mdatagen tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/mdatagen'
go: downloading github.com/knadh/koanf/providers/confmap v0.1.0
rm -fr go.sum
go mod tidy -compat=1.21.0
go: downloading github.com/google/go-cmp v0.6.0
go: downloading github.com/google/uuid v1.6.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/mdatagen'
Running target 'tidy' in module 'cmd/otelcorecol'
make -C cmd/otelcorecol tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/otelcorecol'
go: downloading go.opentelemetry.io/contrib/zpages v0.52.0
go: downloading github.com/golang/snappy v0.0.4
...
go: downloading github.com/tklauser/numcpus v0.6.1
go: updates to go.mod needed; to update it:
        go mod tidy
go: updates to go.mod needed; to update it:
        go mod tidy
rm -fr go.sum
go mod tidy -compat=1.21.0
go: downloading github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0
go: downloading github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c
go: downloading github.com/rogpeppe/go-internal v1.12.0
go: downloading github.com/yusufpapurcu/wmi v1.2.4
go: downloading github.com/go-ole/go-ole v1.2.6
go: downloading github.com/shoenig/go-m1cpu v0.1.6
go: downloading github.com/shoenig/test v0.6.4
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/otelcorecol'
Running target 'tidy' in module 'component'
make -C component tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/component'
go: downloading golang.org/x/net v0.24.0
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237
go: downloading golang.org/x/text v0.14.0
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/component'
Running target 'tidy' in module 'config/configauth'
make -C config/configauth tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configauth'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configauth'
Running target 'tidy' in module 'config/configcompression'
make -C config/configcompression tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configcompression'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configcompression'
Running target 'tidy' in module 'config/configgrpc'
make -C config/configgrpc tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configgrpc'
go: downloading github.com/klauspost/compress v1.17.8
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configgrpc'
Running target 'tidy' in module 'config/confighttp'
make -C config/confighttp tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/confighttp'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/confighttp'
Running target 'tidy' in module 'config/confignet'
make -C config/confignet tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/confignet'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/confignet'
Running target 'tidy' in module 'config/configopaque'
make -C config/configopaque tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configopaque'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configopaque'
Running target 'tidy' in module 'config/configretry'
make -C config/configretry tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configretry'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configretry'
Running target 'tidy' in module 'config/configtelemetry'
make -C config/configtelemetry tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configtelemetry'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configtelemetry'
Running target 'tidy' in module 'config/configtls'
make -C config/configtls tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configtls'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/configtls'
Running target 'tidy' in module 'config/internal'
make -C config/internal tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/internal'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/config/internal'
Running target 'tidy' in module 'confmap'
make -C confmap tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap'
Running target 'tidy' in module 'confmap/converter/expandconverter'
make -C confmap/converter/expandconverter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/converter/expandconverter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/converter/expandconverter'
Running target 'tidy' in module 'confmap/internal/e2e'
make -C confmap/internal/e2e tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/internal/e2e'
rm -fr go.sum
go mod tidy -compat=1.21.0
go: downloading github.com/go-viper/mapstructure/v2 v2.0.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/internal/e2e'
Running target 'tidy' in module 'confmap/provider/envprovider'
make -C confmap/provider/envprovider tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/envprovider'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/envprovider'
Running target 'tidy' in module 'confmap/provider/fileprovider'
make -C confmap/provider/fileprovider tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/fileprovider'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/fileprovider'
Running target 'tidy' in module 'confmap/provider/httpprovider'
make -C confmap/provider/httpprovider tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/httpprovider'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/httpprovider'
Running target 'tidy' in module 'confmap/provider/httpsprovider'
make -C confmap/provider/httpsprovider tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/httpsprovider'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/httpsprovider'
Running target 'tidy' in module 'confmap/provider/yamlprovider'
make -C confmap/provider/yamlprovider tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/yamlprovider'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/confmap/provider/yamlprovider'
Running target 'tidy' in module 'connector'
make -C connector tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/connector'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/connector'
Running target 'tidy' in module 'connector/forwardconnector'
make -C connector/forwardconnector tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/connector/forwardconnector'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/connector/forwardconnector'
Running target 'tidy' in module 'consumer'
make -C consumer tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/consumer'
go: downloading golang.org/x/net v0.23.0
go: downloading golang.org/x/sys v0.18.0
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/consumer'
Running target 'tidy' in module 'exporter'
make -C exporter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter'
Running target 'tidy' in module 'exporter/debugexporter'
make -C exporter/debugexporter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/debugexporter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/debugexporter'
Running target 'tidy' in module 'exporter/loggingexporter'
make -C exporter/loggingexporter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/loggingexporter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/loggingexporter'
Running target 'tidy' in module 'exporter/nopexporter'
make -C exporter/nopexporter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/nopexporter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/nopexporter'
Running target 'tidy' in module 'exporter/otlpexporter'
make -C exporter/otlpexporter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/otlpexporter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/otlpexporter'
Running target 'tidy' in module 'exporter/otlphttpexporter'
make -C exporter/otlphttpexporter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/otlphttpexporter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/exporter/otlphttpexporter'
Running target 'tidy' in module 'extension'
make -C extension tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension'
Running target 'tidy' in module 'extension/auth'
make -C extension/auth tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/auth'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/auth'
Running target 'tidy' in module 'extension/ballastextension'
make -C extension/ballastextension tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/ballastextension'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/ballastextension'
Running target 'tidy' in module 'extension/memorylimiterextension'
make -C extension/memorylimiterextension tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/memorylimiterextension'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/memorylimiterextension'
Running target 'tidy' in module 'extension/zpagesextension'
make -C extension/zpagesextension tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/zpagesextension'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/extension/zpagesextension'
Running target 'tidy' in module 'featuregate'
make -C featuregate tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/featuregate'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/featuregate'
Running target 'tidy' in module 'filter'
make -C filter tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/filter'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/filter'
Running target 'tidy' in module 'internal/e2e'
make -C internal/e2e tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/internal/e2e'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/internal/e2e'
Running target 'tidy' in module 'internal/tools'
make -C internal/tools tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/internal/tools'
rm -fr go.sum
go mod tidy -compat=1.21.0
go: downloading github.com/a8m/envsubst v1.4.2
...
go: downloading github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/internal/tools'
Running target 'tidy' in module 'otelcol'
make -C otelcol tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/otelcol'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/otelcol'
Running target 'tidy' in module 'pdata'
make -C pdata tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/pdata'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/pdata'
Running target 'tidy' in module 'pdata/pprofile'
make -C pdata/pprofile tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/pdata/pprofile'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/pdata/pprofile'
Running target 'tidy' in module 'pdata/testdata'
make -C pdata/testdata tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/pdata/testdata'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/pdata/testdata'
Running target 'tidy' in module 'processor'
make -C processor tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/processor'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/processor'
Running target 'tidy' in module 'processor/batchprocessor'
make -C processor/batchprocessor tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/processor/batchprocessor'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/processor/batchprocessor'
Running target 'tidy' in module 'processor/memorylimiterprocessor'
make -C processor/memorylimiterprocessor tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/processor/memorylimiterprocessor'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/processor/memorylimiterprocessor'
Running target 'tidy' in module 'receiver'
make -C receiver tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/receiver'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/receiver'
Running target 'tidy' in module 'receiver/nopreceiver'
make -C receiver/nopreceiver tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/receiver/nopreceiver'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/receiver/nopreceiver'
Running target 'tidy' in module 'receiver/otlpreceiver'
make -C receiver/otlpreceiver tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/receiver/otlpreceiver'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/receiver/otlpreceiver'
Running target 'tidy' in module 'semconv'
make -C semconv tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/semconv'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/semconv'
Running target 'tidy' in module 'service'
make -C service tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/service'
rm -fr go.sum
go mod tidy -compat=1.21.0
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/service'
Running target 'tidy' in module '/home/moritz_wiesinger/development/opentelemetry-collector'
make -C /home/moritz_wiesinger/development/opentelemetry-collector tidy
make[4]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector'
rm -fr go.sum
go mod tidy -compat=1.21.0
make[4]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector'
make[3]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector'
make[2]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector'
make[1]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector'
# regenerate files
make -C cmd/builder config
make[1]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/builder'
sed '-e/replaces:/,$d' <../otelcorecol/builder-config.yaml > internal/config/default.yaml
make[1]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/builder'
make genotelcorecol
make[1]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector'
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/envsubst -trimpath github.com/a8m/envsubst/cmd/envsubst
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/misspell -trimpath github.com/client9/misspell/cmd/misspell
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/golangci-lint -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/addlicense -trimpath github.com/google/addlicense
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/porto -trimpath github.com/jcchavezs/porto/cmd/porto
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/impi -trimpath github.com/pavius/impi/cmd/impi
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/checkfile -trimpath go.opentelemetry.io/build-tools/checkfile
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/chloggen -trimpath go.opentelemetry.io/build-tools/chloggen
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/crosslink -trimpath go.opentelemetry.io/build-tools/crosslink
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/semconvgen -trimpath go.opentelemetry.io/build-tools/semconvgen
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/apidiff -trimpath golang.org/x/exp/cmd/apidiff
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/goimports -trimpath golang.org/x/tools/cmd/goimports
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/govulncheck -trimpath golang.org/x/vuln/cmd/govulncheck
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/semconvkit -trimpath go.opentelemetry.io/collector/internal/tools/semconvkit
pushd cmd/builder/ && go run ./ --skip-compilation --config ../otelcorecol/builder-config.yaml --output-path ../otelcorecol && popd
~/development/opentelemetry-collector/cmd/builder ~/development/opentelemetry-collector
Flag --output-path has been deprecated, use config distribution::output_path
2024-07-22T06:55:45.929Z        INFO    internal/command.go:125 OpenTelemetry Collector Builder {"version": "", "date": "unknown"}
2024-07-22T06:55:45.931Z        INFO    internal/command.go:161 Using config file       {"path": "../otelcorecol/builder-config.yaml"}
2024-07-22T06:55:45.931Z        INFO    builder/config.go:141   Using go        {"go-executable": "/usr/local/go/bin/go"}
2024-07-22T06:55:45.933Z        INFO    builder/main.go:100     Sources created {"path": "../otelcorecol"}
2024-07-22T06:55:46.137Z        INFO    builder/main.go:191     Getting go modules
2024-07-22T06:55:46.285Z        INFO    builder/main.go:107     Generating source codes only, the distribution will not be compiled.
~/development/opentelemetry-collector
make -C cmd/otelcorecol fmt
make[2]: Entering directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/otelcorecol'
cd /home/moritz_wiesinger/development/opentelemetry-collector/internal/tools && go build -o /home/moritz_wiesinger/development/opentelemetry-collector/.tools/goimports -trimpath golang.org/x/tools/cmd/goimports
gofmt -w -s ./
/home/moritz_wiesinger/development/opentelemetry-collector/.tools/goimports -w  -local go.opentelemetry.io/collector ./
make[2]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector/cmd/otelcorecol'
make[1]: Leaving directory '/home/moritz_wiesinger/development/opentelemetry-collector'
git add .
git commit -m "add multimod changes 0.104.0" || (echo "no multimod changes to commit")
[prepare-release-prs/0.104.0 8e0a4c473] add multimod changes 0.104.0
 5 files changed, 80 insertions(+), 80 deletions(-)
+ COMMANDS+='
- make prepare-release PREVIOUS_VERSION=0[.]103[.]0 RELEASE_CANDIDATE=0.104.0 MODSET=beta'
+ git push origin prepare-release-prs/0.104.0
Username for 'https://github.com': ^C

@mowies
Copy link
Member Author

mowies commented Jul 22, 2024

here's also a sample screenshot from the diff of one of the release preparation commits that happened locally:
Screenshot 2024-07-22 at 09 47 51

@mx-psi
Copy link
Member

mx-psi commented Jul 22, 2024

Awesome, thanks!! I think this should be safe to merge then

@mx-psi mx-psi merged commit a211cc8 into open-telemetry:main Jul 22, 2024
50 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 22, 2024
@mowies mowies deleted the fix-prepare-release-sed branch July 22, 2024 09:36
@mowies
Copy link
Member Author

mowies commented Jul 22, 2024

cool! thx for merging!
i will do the same thing for the similar issue in contrib

mx-psi pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Jul 22, 2024
)

#### Description
This PR fixes an issue where the `.` character in a version string (e.g.
`1.2.3`) was interpreted by `sed` as any character and therefore needed
to be properly escaped. This happened during the prepare-release
workflow.
The version string for the current stable and current beta version
strings provided at pipeline start is replaced as follows:
```
1.2.3 -> 1[.]2[.]3
```

This ensures that `sed` searches for the literal `.` character instead
of interpreting it as a wildcard character.
I specifically used the `[]` syntax to avoid the hassle of "how many
backslashes do i need until it's properly escaped?". (and that for bash
and sed, which work different on different OSes anyways which makes it
hard to test as well)


#### Link to tracking issue
Fixes #23981

#### Notes
This PR uses the same solution as done in
open-telemetry/opentelemetry-collector#10631 to
fix the same issue in that repo.

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
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.

Fix Prepare release workflow
3 participants