-
Notifications
You must be signed in to change notification settings - Fork 11
smoke tests: replace small/full with modern/legacy/windows #627
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
27190cf
smoke tests: replace small/full with modern/legacy/windows
james-nesbitt 57fbb52
ci: add permissions block to smoke-tests workflow
james-nesbitt 3d51733
smoke: fix destroy coverage and remove panic from password generation
james-nesbitt f913163
fix: use key_name not key_pair_id for launch template keypair reference
james-nesbitt beac8a6
fix(terraform): add windows_2025 platform and support windows userdat…
james-nesbitt c2f274d
smoke: make Reset() non-fatal; log timeout as WARN
james-nesbitt ca29f18
terraform: fix Windows password injection in userdata_windows.tpl
james-nesbitt 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,70 @@ | ||
| name: Smoke Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled, opened, synchronize, reopened] | ||
| paths: | ||
| - "**.go" | ||
| - "**.tf" | ||
| - ".terraform.lock.hcl" | ||
| - "go.mod" | ||
| - "go.sum" | ||
| - "examples/terraform/aws-simple/**" | ||
| - ".github/workflows/smoke-tests.yaml" | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| smoke-modern: | ||
| runs-on: ubuntu-latest | ||
| if: | | ||
| github.event_name == 'push' || | ||
| contains(github.event.pull_request.labels.*.name, 'smoke-test') || | ||
| contains(github.event.pull_request.labels.*.name, 'smoke-modern') | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Terraform | ||
| uses: hashicorp/setup-terraform@v3 | ||
| - name: Run modern smoke test | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| run: make smoke-modern | ||
|
|
||
| smoke-legacy: | ||
| runs-on: ubuntu-latest | ||
| if: | | ||
| github.event_name == 'push' || | ||
| contains(github.event.pull_request.labels.*.name, 'smoke-test') || | ||
| contains(github.event.pull_request.labels.*.name, 'smoke-legacy') | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Terraform | ||
| uses: hashicorp/setup-terraform@v3 | ||
| - name: Run legacy smoke test | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| run: make smoke-legacy | ||
|
|
||
| smoke-windows: | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| runs-on: ubuntu-latest | ||
| if: | | ||
| github.event_name == 'push' || | ||
| contains(github.event.pull_request.labels.*.name, 'smoke-test') || | ||
| contains(github.event.pull_request.labels.*.name, 'smoke-windows') | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Terraform | ||
| uses: hashicorp/setup-terraform@v3 | ||
| - name: Run windows smoke test | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| run: make smoke-windows | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,22 +1,83 @@ | ||
|
|
||
| // variables calculated before ami data is retrieved | ||
| locals { | ||
| // find the unique platforms actually used in the node_group_definitions, so that we can combine platform definiton and ami data together | ||
| // - this is unique to avoid repeated ami pulls for the same definition | ||
| // - only node-group platforms are pulled to avoid pulling images data sources that are not used anywhere | ||
| // find the unique platforms actually used in the node_group_definitions | ||
| unique_used_platforms = distinct([for ngd in var.nodegroups : ngd.platform]) | ||
|
|
||
| // platforms defined in the upstream module | ||
| upstream_platform_keys = [for p in local.unique_used_platforms : p if !contains(keys(local.lib_local_platform_definitions), p)] | ||
| // platforms defined locally (not in upstream module) | ||
| local_platform_keys = [for p in local.unique_used_platforms : p if contains(keys(local.lib_local_platform_definitions), p)] | ||
|
|
||
| // local platform AMI definitions (supplements upstream module) | ||
| lib_local_platform_definitions = { | ||
| "ubuntu_24.04" = { | ||
| ami_name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" | ||
| owner = "099720109477" | ||
| interface = "eth0" | ||
| connection = "ssh" | ||
| ssh_user = "ubuntu" | ||
| ssh_port = 22 | ||
| } | ||
| "windows_2025" = { | ||
| ami_name = "Windows_Server-2025-English-Core-Base-*" | ||
| owner = "801119661308" | ||
| interface = "Ethernet 3" | ||
| connection = "winrm" | ||
| winrm_user = "Administrator" | ||
| winrm_useHTTPS = true | ||
| winrm_insecure = true | ||
| } | ||
| } | ||
| } | ||
|
|
||
| module "platform" { | ||
| count = length(local.unique_used_platforms) | ||
| count = length(local.upstream_platform_keys) | ||
| source = "terraform-mirantis-modules/provision-aws/mirantis//modules/platform" | ||
|
|
||
| platform_key = local.unique_used_platforms[count.index] | ||
| platform_key = local.upstream_platform_keys[count.index] | ||
| windows_password = var.windows_password | ||
| } | ||
|
|
||
| data "aws_ami" "local" { | ||
| for_each = { for p in local.local_platform_keys : p => local.lib_local_platform_definitions[p] } | ||
|
|
||
| most_recent = true | ||
| owners = [each.value.owner] | ||
|
|
||
| filter { | ||
| name = "name" | ||
| values = [each.value.ami_name] | ||
| } | ||
|
|
||
| filter { | ||
| name = "architecture" | ||
| values = ["x86_64"] | ||
| } | ||
|
|
||
| filter { | ||
| name = "virtualization-type" | ||
| values = ["hvm"] | ||
| } | ||
| } | ||
|
|
||
| // variables calculated after ami data is pulled | ||
| locals { | ||
| // convert platform ami list to a map | ||
| platforms_with_ami = { for k, p in local.unique_used_platforms : p => module.platform[k].platform } | ||
| // upstream platforms: build map from upstream module outputs | ||
| upstream_platforms_with_ami = { | ||
| for k, p in local.upstream_platform_keys : p => module.platform[k].platform | ||
| } | ||
|
|
||
| // local platforms: build map matching the shape upstream module produces | ||
| local_platforms_with_ami = { | ||
| for p, def in local.lib_local_platform_definitions : p => merge(def, { | ||
| ami = data.aws_ami.local[p].id | ||
| root_device_name = data.aws_ami.local[p].root_device_name | ||
| user_data = def.connection == "winrm" ? templatefile("${path.module}/userdata_windows.tpl", { | ||
| windows_administrator_password = var.windows_password | ||
| }) : "" | ||
| }) if contains(local.local_platform_keys, p) | ||
| } | ||
|
|
||
| // merge upstream + local into the single map consumed by provision.tf / launchpad.tf | ||
| platforms_with_ami = merge(local.upstream_platforms_with_ami, local.local_platforms_with_ami) | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.