Commit graph

37 commits

Author SHA1 Message Date
Ondřej Budai
a32ff633ba upload/koji: make koji runner work with docker
The setup should be container engine agnostic. This changes allows this script
to be run on systems which prefer docker over podman (e.g. Github Actions).
2020-08-27 17:29:57 +01:00
Alexander Todorov
963e46f50d Always use .vmdk suffix after streamOptimized conversion
b/c vCenter gets confused by the .stream suffix
2020-08-26 14:45:31 +02:00
Alexander Todorov
3292b5eb68 Do not unlink file while it is still open
- inside RunJob() there is a deferred function which will remove
  the entire temporary directory in which images are created, including
  the streamOptimized file

- inside testBootUsingVMware(), which wants to use this function,
  there is already a deferred function which removes the converted
  image
2020-08-26 14:45:31 +02:00
Alexander Todorov
e7aa9c10c2 Move openAsStreamOptimizedVmdk() into importable package
so it can be used later within tests
2020-08-26 14:45:31 +02:00
Ondřej Budai
8d1c187f3c upload/azure: delete the unused test
This test is not run anywhere because it was surpassed by image tests with
azure boot type which perform more than just uploading a randomly generated
file to Azure. Let's delete dead code.
2020-08-25 10:41:10 +02:00
Ondřej Budai
c711b9149e remove travis mentions in codebase
Travis is no longer used, let's ditch these.
2020-08-25 10:41:10 +02:00
Major Hayden
70c32ef7c5 awsupload: Add comments for Register()
Please the golang linter by adding a small comment for the Register
function.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
02306c978e awsupload: Better emoji for snapshot wait
The clock emoji isn't as well supported as the 🚚.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
6659ab58ad awsupload: Apply tags to imported snapshot
Applying a `Name` tag to the snapshot makes the name of the image appear
in the snapshot listing in EC2's console. It also makes it easier to
remove a snapshot after deregistering the AMI.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
fc7f6349eb awsupload: Add description to snapshots
Make it easier to tell which snapshot goes with each AMI by labeling
them with a description.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
38e4fe8781 Add more emojis to AWS upload logs
Now that we know emojis work properly with osbuild-composer and systemd,
let's add some more.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-05 19:56:57 +02:00
Tom Gundersen
27e2d17911 awsupload: fix printing of IDs
The AWS API always uses pointers to strings everywhere, rather than
plain strings. The log messages got this wrong and printed the pointers
rather than dereferencing them.

Don't require users to do a memory dump to get at the AMIs, but instead
print the actual strings. Also change to %s from %v to let the linter
warn us in the future. %s accepts only strings, whereas %v prints
whatever you throw at it.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-04 10:05:12 +02:00
Ondřej Budai
761be27f32 upload/aws: fail ImportSnapshot when the snapshot is deleted
When ImportSnapshot fails, it goes into the deleted state. However, the code
didn't consider this state as a failure. This commit fixes that.

Fixes #706
2020-06-03 21:55:46 +02:00
Major Hayden
1c9ded8e53 Add basic logging to AWS upload process
The AWS upload process takes time and has multiple steps that can fail
or take an extended time to run.

Add some basic logging to various parts of the AWS upload process to
assist with troubleshooting in CI and production.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-03 21:02:58 +02:00
Major Hayden
fb35868ea3 Let AWS figure out the image format during import
Specifying the image format in the `DiskContainers` part of the snapshot
import process sometimes causes AWS to fail the import due to formatting
issues. However, AWS seems to do a decent job at determining the image
format on its own without specifying the format explicitly.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-02 22:00:05 +02:00
Major Hayden
1d16dc4d73 Remove AWS snapshot import timeout
Importing an image into an EBS snapshot can sometimes take a long time.
The customer experience for a timeout is not great.

Allow the import to continue running for as long as needed without
timing out. This allows a customer to monitor the process of their
import until it has a success or failure status.

Fixes osbuild/osbuild-composer#632.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-19 22:34:04 +02:00
Ondřej Budai
4ebf6ee85b upload/koji: add a simple test
This commit adds a test which uploads a random file to Koji and runs CGImport.
The result is checked using the koji cli client.
2020-05-19 13:54:53 +02:00
Ondřej Budai
87a7e90c98 upload/koji: return the CGImport result
Currently, only build id is returned, more will come when needed.
2020-05-19 13:54:53 +02:00
Ondřej Budai
e43eb4da7b upload/koji: make the hexdigest field consistent
We usually try to match the field name with its json/toml/xmlrpc tag. This
commit does exactly that.
2020-05-19 13:54:53 +02:00
Ondřej Budai
184cd24426 upload/koji: handle the unmarshalling error 2020-05-19 13:54:53 +02:00
Ondřej Budai
0c87a7f524 upload/koji: handle the xmlrpc error
This is the way to handle situations when the remote method errors.
2020-05-19 13:54:53 +02:00
Tom Gundersen
76515066a8 upload/koji: add helpers to upload to koji
This does not yet actually upload the image, and it only supports empty
images. You need to place a an empty file named <filename>, with a valid
extension (e.g., .qcow2) in /mnt/koji/work/<directory>/.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-05-19 13:54:53 +02:00
Major Hayden
d4b7c1d0c7 CI: Test EC2 import and boot
Build an AWS AMI image, upload it to S3, import it into EC2, and boot
it.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-18 10:27:24 -05:00
Ondřej Budai
6513263a14 upload/azure: force .vhd extension
Azure cannot create an image from a storage blob without .vhd extension.
This commit ensures that image always has the right extension.
2020-04-29 18:15:13 +02:00
Ondřej Budai
1d52dfcc2b upload/azure: fix typos 2020-04-29 18:15:13 +02:00
Ondřej Budai
5415be465f upload/azure: remove an unneeded custom error type
The errorString was not exported and used anywhere else, this commit replaces
it with a standard method of creating simple errors.
2020-04-29 18:15:13 +02:00
Ondřej Budai
e52a35d84e upload/azure: add a context to errors
Debugging azure upload fails is currently pretty hard, this commit adds
a context to all errors Azure upload can emit.
2020-04-29 18:15:13 +02:00
Ondřej Budai
83a3a8d821 change the format of the ami image type to vhdx
Prior this commit the ami image type produced raw.xz images. This was bad for
two reasons:

- The upload was broken because AWS doesn't support tar.xz format
- XZ compression is terribly slow

This commit changes the format to vhdx, which is supported by AWS and also
quite quick. See https://github.com/osbuild/osbuild-composer/issues/257
why vhdx was chosen.

Fixes #257
2020-04-24 15:27:39 +02:00
Ondřej Budai
5e49b026ca tests: remove the old aws unit test
The old aws unit test is not very useful now, because there's the new
integration test which covers a lot more. Therefore, this commit
removes it.

Fixes #512
2020-04-19 21:54:43 +02:00
Ondřej Budai
b2048b9796 upload/aws: double the timeout for snapshot import
us-east-1 seems to very slow these days, some imports can take up to
15 minutes. This commit raises the number of attempts before we give up.
Previously, we did 40 attempts, each delayed by 15 seconds, making the total
timeout equal to 10 minutes. Now we do 80 attempts with the same delay,
making the total timeout 20 minutes.
2020-04-15 01:16:33 +02:00
Ondřej Budai
9a96908c1e upload/aws: delete the s3 object after the snapshot is imported
After the snapshot is imported to EC2, there's no point in having the s3
object anymore. If the s3 object is not deleted, the user will be charged
for it periodically, while the object doesn't provide any value.
2020-04-04 02:49:00 +02:00
Ondřej Budai
d7cbc22da4 lint: fix unhandled errors 2020-03-02 14:28:55 +01:00
Ondřej Budai
1676cf58da lint: fix gosimple/S1004 errors 2020-03-02 14:28:55 +01:00
Ondřej Budai
3ff88c336f fix ineffectual assignments found by golangci-lint 2020-02-14 12:41:09 +01:00
Ondřej Budai
6b662663f3 upload/aws: Add basic S3 upload test
The test is very simple, it just uploads object to S3, downloads it back and
compares them.
2020-01-16 13:14:15 +01:00
Martin Sehnoutka
364ea62f59 Introduce Azure upload test
The test is very simple, it first upload a file with random content and
then downloads it back and compare hashes.
2019-11-29 12:19:40 +01:00
Martin Sehnoutka
1135e9fe01 Refactor Azure upload code to a separate package
as part of this, move also the AWS upload code to the same directory
2019-11-27 12:14:07 +01:00