Skip to content

Commit

Permalink
Add new test/release pipelines for SDK V2 migration
Browse files Browse the repository at this point in the history
Depending on which branch a PR is created, to test and release
the controller using different versions of code-gen and runtime
(whether the controller is generated with aws-sdk V1 or V2)
* Test
  • Loading branch information
michaelhtm committed Jan 10, 2025
1 parent e5665fb commit 1df36a1
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 479 deletions.
536 changes: 75 additions & 461 deletions prow/jobs/jobs.yaml

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion prow/jobs/jobs_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ aws_services:
- ssm
- wafv2

aws_services_v2:
- eks

# List of service that will execute a set of tests for CARM
# These service need a CARM_ENABLED environment variable set to true
carm_test_services:
Expand Down Expand Up @@ -114,4 +117,7 @@ runtime_presubmit_services:
acktest_presubmit_services:
- ecr
- iam
- s3
- s3

sdk_v2_support_services:
- eks
2 changes: 1 addition & 1 deletion prow/jobs/labels.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Autogenerated. Do NOT update Manually
# Last generated on 2024-12-23 12:18:23.
# Last generated on 2025-01-10 11:53:02.
#
# default: global configuration to be applied to all repos
# repos: list of repos with specific configuration to be applied in addition to default
Expand Down
37 changes: 36 additions & 1 deletion prow/jobs/templates/postsubmits/codegen_release.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,39 @@
memory: "4096Mi"
command: ["/bin/bash", "-c", "./cd/auto-generate/auto-generate-controllers.sh"]
branches: #supports tags too.
- ^v[0-9]+\.[0-9]+\.[0-9]+$
- ^v[0-9]+\.[0-9]+\.[0]$

- name: auto-generate-controllers-v2
decorate: true
annotations:
karpenter.sh/do-not-evict: "true"
labels:
preset-github-secrets: "true"
extra_refs:
- org: aws-controllers-k8s
repo: test-infra
base_ref: main
workdir: true
- org: aws-controllers-k8s
repo: runtime
base_ref: main
workdir: false
{{range $_, $service := .Config.AWSServicesV2}}- org: aws-controllers-k8s
repo: {{ $service }}-controller
base_ref: main
workdir: false
{{- end }}
spec:
serviceAccountName: post-submit-service-account
containers:
- image: {{printf "%s:%s" $.ImageContext.ImageRepo (index $.ImageContext.Images "auto-generate-controllers") }}
resources:
limits:
cpu: 8
memory: "4096Mi"
requests:
cpu: 2
memory: "4096Mi"
command: ["/bin/bash", "-c", "./cd/auto-generate/auto-generate-controllers.sh"]
branches: #supports tags too.
- ^v[0-9]+\.[4][0]\.[0-9]+$
12 changes: 11 additions & 1 deletion prow/jobs/templates/presubmits/code_generator_tests.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@
extra_refs:
- org: aws-controllers-k8s
repo: runtime
{{- if contains $.Config.SDKV2SupportServices $service }}
base_ref: aws-sdk-go-v2
{{- else }}
base_ref: main
{{- end }}
workdir: false
- org: aws-controllers-k8s
repo: test-infra
Expand Down Expand Up @@ -142,4 +146,10 @@
value: "ResourceAdoption=true"
{{ end -}}
command: ["wrapper.sh", "bash", "-c", "./cd/core-validator/generate-test-controller.sh"]
{{ end }}
branches:
{{- if contains $.Config.SDKV2SupportServices $service }}
- aws-sdk-go-v2
{{- else }}
- main
{{- end }}
{{ end }}
9 changes: 7 additions & 2 deletions prow/jobs/templates/presubmits/runtime_tests.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
extra_refs:
- org: aws-controllers-k8s
repo: code-generator
{{- if contains $.Config.SDKV2SupportServices $service }}
base_ref: aws-sdk-go-v2
{{- else }}
base_ref: main
{{- end }}
workdir: false
- org: aws-controllers-k8s
repo: test-infra
Expand Down Expand Up @@ -109,5 +113,6 @@
value: "ResourceAdoption=true"
{{ end -}}
command: ["wrapper.sh", "bash", "-c", "make kind-test SERVICE=$SERVICE"]

{{ end }}
branches:
- main
{{ end }}
8 changes: 0 additions & 8 deletions prow/jobs/templates/presubmits/service_tests.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
preset-kind-volume-mounts: "true"
preset-test-config: "true"
extra_refs:
- org: aws-controllers-k8s
repo: code-generator
base_ref: main
workdir: false
- org: aws-controllers-k8s
repo: test-infra
base_ref: main
Expand Down Expand Up @@ -60,10 +56,6 @@
preset-kind-volume-mounts: "true"
preset-test-config: "true"
extra_refs:
- org: aws-controllers-k8s
repo: code-generator
base_ref: main
workdir: false
- org: aws-controllers-k8s
repo: test-infra
base_ref: main
Expand Down
9 changes: 5 additions & 4 deletions prow/jobs/tools/cmd/command/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ type ImageContext struct {
// Structure for prow job configurations stored in
// jobs.yaml
type Config struct {
AddoptionTestServices []string `yaml:"addoption_test_services"`
AddoptionTestServices []string `yaml:"addoption_test_services"`
AWSServices []string `yaml:"aws_services"`
AWSServicesV2 []string `yaml:"aws_services_v2"`
CarmTestServices []string `yaml:"carm_test_services"`
SoakTestOnReleaseServiceNames []string `yaml:"soak_test_on_release_service_names"`
CodegenPresubmitServices []string `yaml:"code_gen_presubmit_services"`
RuntimePresubmitServices []string `yaml:"runtime_presubmit_services"`
ACKTestPresubmitServices []string `yaml:"acktest_presubmit_services"`
SDKV2SupportServices []string `yaml:"sdk_v2_support_services"`
}

func loadImages(imageConfigPath string) (*ImageContext, error) {
Expand Down Expand Up @@ -113,7 +115,7 @@ func generateJobs(templatePath, outputPath string, imageContext *ImageContext, c

var prowjobsContent strings.Builder
prowjobsContent.WriteString("# Autogenerated. Do NOT update Manually.\n")
prowjobsContent.WriteString(fmt.Sprintf("# Last generated on %v\n", time.Now().Format(time.DateTime)))
prowjobsContent.WriteString(fmt.Sprintf("# Last generated on %v\n", time.Now().Format(time.DateTime)))

periodicsContent, err := loadTemplates("periodics", periodicJobsPath, imageContext, config)
if err != nil {
Expand Down Expand Up @@ -161,7 +163,6 @@ func generateLabelSyncConfig(templatePath, outputPath string, config *Config) er
return err
}


// Generate will generate labels or jobs, depending on variable "what" is.
// what: can be either labels or jobs.
func Generate(what, jobsConfigPath, imagesConfigPath, templatePath, outputPath string) error {
Expand All @@ -181,4 +182,4 @@ func Generate(what, jobsConfigPath, imagesConfigPath, templatePath, outputPath s
err = generateLabelSyncConfig(templatePath, outputPath, config)
}
return err
}
}

0 comments on commit 1df36a1

Please sign in to comment.