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

Script to verify example after new release. #579

Merged
merged 5 commits into from
Mar 30, 2020

Conversation

rghetia
Copy link
Contributor

@rghetia rghetia commented Mar 22, 2020

This script verifies that examples build outside of the otel repo.
This should be run after every release.

@rghetia rghetia changed the title verify example script. Script to verify example after new release. Mar 22, 2020
Copy link
Member

@krnowak krnowak left a comment

Choose a reason for hiding this comment

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

Some nits.

mkdir -p $DIR_TMP

printf "Copy examples to ${DIR_TMP}\n"
rsync -r ./example ${DIR_TMP}
Copy link
Member

Choose a reason for hiding this comment

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

Is there something in rsync -r that cp -a wouldn't do?

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 was using cp -p and that didn't work on Mac. Didn't know '-a' was an option.
Changed it to cp -a.

Comment on lines 44 to 71
(cd "${DIR_TMP}/${dir}" && \
sed -i .bak "s/module go.opentelemetry.io\/otel/module oteltmp/" go.mod && \
sed -i .bak "s/^.*=\>.*$//" go.mod && \
go mod tidy)
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking that maybe we should avoid tinkering with go.mod like that and use go mod edit for it, like:

(cd "${dir}"
 # replaces is ("mod1" "mod2" …)
 replaces=($(go mod edit -json | jq '.Replace[].Old.Path'))
 # strip double quotes
 replaces=("${replaces[@]%\"}")
 replaces=("${replaces[@]#\"}")
 # make an array (-dropreplace=mod1 -dropreplace=mod2 …)
 dropreplaces=("${replaces[@]/#/-dropreplace=}")
 go mod edit -module "oteltmp/${dir}" "${dropreplaces[@]}"
 go mod tidy)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point and nice suggestion. Learning few tricks as well..

# directories that contain go.mod files.
#
printf "Build examples:\n"
EXAMPLES=`./get_main_pkgs.sh ./example`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXAMPLES=`./get_main_pkgs.sh ./example`
EXAMPLES=$(./get_main_pkgs.sh ./example)

# See the License for the specific language governing permissions and
# limitations under the License.

set -e
Copy link
Member

Choose a reason for hiding this comment

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

set -euo pipefail maybe could be a better safety net. -u is for bailing out on undefined variables (like in rm -rf ${undefined}/* ;) ). -o pipefail for bailing out in scenario like failing_command | process_stdin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -0,0 +1,64 @@
#!/bin/sh
Copy link
Member

Choose a reason for hiding this comment

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

I'd say just use bash and let's not pretend we care to be ran under every possible implementation of POSIX shell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -0,0 +1,64 @@
#!/bin/sh
# Copyright 2020, OpenTelemetry Authors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Copyright 2020, OpenTelemetry Authors
# Copyright The OpenTelemetry Authors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

printf "$(git log -1)"
printf "\n\nError: HEAD is not pointing to a tagged version"
fi
exit
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks leftover from debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops!

fixed now.

@rghetia rghetia merged commit f474c34 into open-telemetry:master Mar 30, 2020
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.

4 participants