-
Notifications
You must be signed in to change notification settings - Fork 55
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
ci-automation: add hetzner testing #2142
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2023 The Flatcar Maintainers. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
set -euo pipefail | ||
|
||
# Test execution script for the Hetzner vendor. | ||
# This script is supposed to run in the mantle container. | ||
|
||
source ci-automation/vendor_test.sh | ||
|
||
hetzner_instance_type_var="HETZNER_${CIA_ARCH}_INSTANCE_TYPE" | ||
hetzner_instance_type="${!hetzner_instance_type_var}" | ||
|
||
# HETZNER_TPS_TOKEN should be provided by sdk_container/.env | ||
|
||
# We first need to create a temporary project using HETZNER_TPS_TOKEN | ||
# When the project is created it returns a regular HETZNER_TOKEN that can be used | ||
# in the next commands, it is a token similar to what you would get in your Hetzner console. | ||
HETZNER_TOKEN=$(curl \ | ||
--fail-with-body \ | ||
--retry 2 \ | ||
--silent \ | ||
--user-agent "flatcar-ci/unknown" \ | ||
--request POST \ | ||
--header "Authorization: Bearer ${HETZNER_TPS_TOKEN}" \ | ||
https://tps.hc-integrations.de | ||
) | ||
|
||
# Upload the image on Hetzner. | ||
IMAGE_ID=$(ore hetzner \ | ||
--hetzner-token="${HETZNER_TOKEN}" \ | ||
--hetzner-location="${HETZNER_LOCATION}" \ | ||
create-image \ | ||
--board="${CIA_ARCH}-usr" \ | ||
--name flatcar-"${CIA_VERNUM}" \ | ||
--file="https://${BUILDCACHE_SERVER}/images/${CIA_ARCH}/${CIA_VERNUM}/${HETZNER_IMAGE_NAME}" | ||
) | ||
|
||
kola_test_basename="ci-${CIA_VERNUM//[+.]/-}" | ||
|
||
set -x | ||
|
||
timeout --signal=SIGQUIT 2h kola run \ | ||
--board="${CIA_ARCH}-usr" \ | ||
--parallel="${HETZNER_PARALLEL}" \ | ||
--tapfile="${CIA_TAPFILE}" \ | ||
--channel="${CIA_CHANNEL}" \ | ||
--basename="${kola_test_basename}" \ | ||
--platform=hetzner \ | ||
--hetzner-token="${HETZNER_TOKEN}" \ | ||
krnowak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--hetzner-server-type="${hetzner_instance_type}" \ | ||
--hetzner-location="${HETZNER_LOCATION}" \ | ||
--hetzner-image=${IMAGE_ID} \ | ||
"${@}" | ||
|
||
set +x |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment about why we override the user agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apricote any idea why we need this? I see it's similar to this: https://github.com/hetznercloud/tps-action/blob/dee5dd2546322c28ed8f74b910189066e8b6f31a/get-token.sh#L19 but not sure why we need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a debugging aid?
hetznercloud/tps-action#5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works without the user agent. Having the user agent in requests is helpful for us operating the service as we can easily figure out who is affected by any errors, who is sending too many requests...
Of course, the user agent can easily be faked by anyone, so we don't fully rely on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @apricote for sharing the details. Let's keep the user agent like this in this case as it can help you to monitor the TPS system.