diff --git a/internal/upload/awsupload/awsupload.go b/internal/upload/awsupload/awsupload.go index 7207596e3..aa033669d 100644 --- a/internal/upload/awsupload/awsupload.go +++ b/internal/upload/awsupload/awsupload.go @@ -71,10 +71,14 @@ func WaitUntilImportSnapshotTaskCompleted(c *ec2.EC2, input *ec2.DescribeImportS // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. +// +// NOTE(mhayden): Wait for 45 minutes for the snapshot to import. +// Some AWS regions are fairly busy with image imports and they can +// sometimes take a long time. func WaitUntilImportSnapshotTaskCompletedWithContext(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeImportSnapshotTasksInput, opts ...request.WaiterOption) error { w := request.Waiter{ Name: "WaitUntilImportSnapshotTaskCompleted", - MaxAttempts: 80, // this can take up to 15 minutes, therefore set the timeout to 20 minutes + MaxAttempts: 180, Delay: request.ConstantWaiterDelay(15 * time.Second), Acceptors: []request.WaiterAcceptor{ { diff --git a/schutzbot/Jenkinsfile b/schutzbot/Jenkinsfile index cfab90976..ee35dc582 100644 --- a/schutzbot/Jenkinsfile +++ b/schutzbot/Jenkinsfile @@ -62,6 +62,23 @@ pipeline { } } } + stage('Fedora 32 AWS') { + agent { label "fedora32" } + environment { + TEST_TYPE = "aws" + AWS_CREDS = credentials('aws-credentials-osbuildci') + AWS_REGION = "us-east-2" + AWS_BUCKET = "imagebuilder-jenkins-testing-use2" + } + steps { + run_tests() + } + post { + always { + preserve_logs('fedora32-image') + } + } + } stage('RHEL 8.2 base') { agent { label "rhel82" } environment { TEST_TYPE = "base" } diff --git a/schutzbot/test.yml b/schutzbot/test.yml index a1c7ee98c..690f307e6 100644 --- a/schutzbot/test.yml +++ b/schutzbot/test.yml @@ -22,9 +22,23 @@ loop: "{{ osbuild_composer_image_test_cases }}" loop_control: loop_var: test_case + vars: + test_timeout: "{{ osbuild_composer_image_timeout }}" + env_vars: "{{ osbuild_composer_image_env_vars }}" when: - test_type == 'image' + - name: Run osbuild-composer AWS tests + include_tasks: test_runner_image.yml + loop: "{{ osbuild_composer_aws_test_cases }}" + vars: + test_timeout: "{{ osbuild_composer_aws_timeout }}" + env_vars: "{{ osbuild_composer_aws_env_vars }}" + loop_control: + loop_var: test_case + when: + - test_type == 'aws' + - name: Show failed and passed tests debug: msg: | diff --git a/schutzbot/test_runner_image.yml b/schutzbot/test_runner_image.yml index 876b5c3d8..c453a4e6f 100644 --- a/schutzbot/test_runner_image.yml +++ b/schutzbot/test_runner_image.yml @@ -14,10 +14,11 @@ - name: "Run image test case: {{ test_case_prefix }}-{{ test_case }}" command: | {{ image_test_executable }} -test.v \ - -test.timeout {{image_test_timeout * 60}}s \ + -test.timeout {{ test_timeout * 60 }}s \ {{ image_test_case_path }}/{{ test_case_prefix }}-{{ test_case }} args: chdir: "{{ tests_working_directory }}" + environment: "{{ env_vars }}" register: test_cmd - name: "Mark test case as passed: {{ test_case_prefix }}-{{ test_case }}" diff --git a/schutzbot/vars.yml b/schutzbot/vars.yml index c5ae9b7b9..5db9fa788 100644 --- a/schutzbot/vars.yml +++ b/schutzbot/vars.yml @@ -25,13 +25,11 @@ osbuild_composer_base_tests: # Executable that runs image tests. image_test_executable: "{{ tests_path }}/osbuild-image-tests" -# Timeout for image tests (in minutes). -image_test_timeout: 45 - # Location of image test case files. image_test_case_path: /usr/share/tests/osbuild-composer/cases -# List of image tests and their timeouts (in minutes). +# List of image tests and their timeout (in minutes). +osbuild_composer_image_timeout: 15 osbuild_composer_image_test_cases: - ami-boot.json - ext4_filesystem-boot.json @@ -41,3 +39,18 @@ osbuild_composer_image_test_cases: - tar-boot.json - vhd-boot.json - vmdk-boot.json + +# Environment variables for image tests. +osbuild_composer_image_env_vars: {} + +# List of AWS test cases and their timeout (in minutes). +osbuild_composer_aws_timeout: 60 +osbuild_composer_aws_test_cases: + - ami-boot.json + +# Environment variables for AWS tests. +osbuild_composer_aws_env_vars: + AWS_BUCKET: "{{ lookup('env', 'AWS_BUCKET') }}" + AWS_REGION: "{{ lookup('env', 'AWS_REGION') }}" + AWS_ACCESS_KEY_ID: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}" + AWS_SECRET_ACCESS_KEY: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}" \ No newline at end of file