Skip to content
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

⚠️ CONFLICT! Lineage pull request for: skeleton #28

Merged
merged 32 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
297ce13
Modify the ansible-core pin to ensure a good version is used
jsf9k May 21, 2024
07e2b60
Pin ansible-core when running the ansible-lint linter
jsf9k May 4, 2024
c74e5db
Remove unnecessary line
jsf9k May 4, 2024
2e53e0d
Explain why ansible may need to be added as a dependency for ansible-…
jsf9k May 7, 2024
f51fe62
Update pre-commit hook versions
mcdonnnj May 11, 2024
8e55b8e
Manually update the prettier hook
mcdonnnj Jun 6, 2024
c617bb9
Correct commented-out ansible pin
jsf9k Jun 6, 2024
de92c3c
Merge pull request #183 from cisagov/maintenance/update_pre-commit_hooks
mcdonnnj Jun 6, 2024
7ddea47
Merge pull request #182 from cisagov/improvement/pin-packages-for-ans…
mcdonnnj Jun 6, 2024
bc369af
Merge https://github.com/cisagov/skeleton-generic into lineage/skeleton
Jun 6, 2024
b66d137
Merge pull request #338 from cisagov/improvement/remove-ansible-core-pin
jsf9k Aug 12, 2024
6334bf2
Merge pull request #343 from cisagov/lineage/skeleton
jsf9k Aug 12, 2024
6041172
Alphabetize filters by name
jsf9k Jul 7, 2024
89c7e1e
Add a filter for the AMI's architecture
jsf9k Jul 7, 2024
d58b660
Add an architecture filter in the Packer config
jsf9k Jul 8, 2024
aaeb8bd
Add an ARM64 source to the Packer configuration
jsf9k Jul 10, 2024
2452ca5
Build both the x86-64 and ARM64 versions of the AMI
jsf9k Jul 10, 2024
8dec775
Update the AMI filter to include both the x86-64 and ARM64 AMIs
jsf9k Jul 10, 2024
793b46d
Bump version from 1.0.1 to 2.0.0
jsf9k Jul 10, 2024
95dc9a3
Bump version from 2.0.0 to 2.0.0-rc.1
jsf9k Jul 10, 2024
f6dbbb8
Reorder data blocks to match order of source blocks
jsf9k Jul 11, 2024
9332c38
Create separate resources for ARM64 and x86-64 AMIs and launch permis…
jsf9k Jul 11, 2024
18765c6
Add moved blocks for renamed resources
jsf9k Jul 11, 2024
51944d0
Add comments to moved blocks to explain the intent
jsf9k Aug 8, 2024
88528fe
Fix typos (missing spaces)
jsf9k Aug 9, 2024
f161416
Finalize version from 2.0.0-rc.1 to 2.0.0
jsf9k Aug 12, 2024
d44181d
Merge pull request #355 from cisagov/improvement/specify-architecture…
jsf9k Aug 12, 2024
b4ce89e
Merge remote-tracking branch 'skeleton-packer/develop' into lineage/s…
jsf9k Aug 14, 2024
012f329
Bump version from 1.4.0 to 1.5.0
jsf9k Aug 14, 2024
f2789e5
Bump version from 1.5.0 to 1.5.0-rc.1
jsf9k Aug 14, 2024
191cd34
Correct ssh username in arm64 source block
jsf9k Aug 14, 2024
081e7a1
Finalize version from 1.5.0-rc.1 to 1.5.0
jsf9k Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ jobs:
- lint
- test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
architecture:
- arm64
- x86_64
steps:
- id: harden-runner
name: Harden the runner
Expand Down Expand Up @@ -315,7 +321,8 @@ jobs:
# This runs through the AMI creation process but does not
# actually create an AMI
run: |
packer build -timestamp-ui \
packer build -only amazon-ebs.${{ matrix.architecture }} \
-timestamp-ui \
-var skip_create_ami=true \
src/packer.pkr.hcl
- name: Remove /usr/bin/python3 symlink to the installed Python
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
needs:
- diagnostics
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
architecture:
- arm64
- x86_64
steps:
- id: harden-runner
name: Harden the runner
Expand Down Expand Up @@ -108,7 +114,8 @@ jobs:
run: packer init src
- name: Create machine image
run: |
packer build -timestamp-ui \
packer build -only amazon-ebs.${{ matrix.architecture }} \
-timestamp-ui \
-var is_prerelease=${{ github.event.release.prerelease }} \
-var release_tag=${{ github.event.release.tag_name }} \
-var release_url=${{ github.event.release.html_url }} \
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
needs:
- diagnostics
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
architecture:
- arm64
- x86_64
steps:
- id: harden-runner
name: Harden the runner
Expand Down Expand Up @@ -123,7 +129,8 @@ jobs:
run: packer init src
- name: Create machine image
run: |
packer build -timestamp-ui \
packer build -only amazon-ebs.${{ matrix.architecture }} \
-timestamp-ui \
-var is_prerelease=${{ github.event.release.prerelease }} \
-var release_tag=${{ github.event.release.tag_name }} \
-var release_url=${{ github.event.release.html_url }} \
Expand Down
46 changes: 32 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
Expand All @@ -31,7 +31,7 @@ repos:

# Text file hooks
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.41.0
hooks:
- id: markdownlint
args:
Expand All @@ -46,7 +46,7 @@ repos:
# mirror does not pull tags for old major versions once a new major
# version tag is published.
additional_dependencies:
- prettier@3.2.5
- prettier@3.3.1
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
Expand All @@ -56,14 +56,14 @@ repos:

# GitHub Actions hooks
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
rev: 0.28.4
hooks:
- id: check-github-actions
- id: check-github-workflows

# pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit
rev: v3.6.2
rev: v3.7.1
hooks:
- id: validate_manifest

Expand Down Expand Up @@ -98,7 +98,7 @@ repos:

# Shell script hooks
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-4
rev: v3.8.0-1
hooks:
- id: shfmt
args:
Expand All @@ -116,14 +116,14 @@ repos:
# Redirect operators are followed by a space
- --space-redirects
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
rev: v0.10.0.1
hooks:
- id: shellcheck

# Python hooks
# Run bandit on the "tests" tree with a configuration
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
rev: 1.7.8
hooks:
- id: bandit
name: bandit (tests tree)
Expand All @@ -138,7 +138,7 @@ repos:
name: bandit (everything else)
exclude: tests
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -152,24 +152,42 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
rev: v3.15.2
hooks:
- id: pyupgrade

# Ansible hooks
- repo: https://github.com/ansible/ansible-lint
rev: v24.2.0
rev: v24.6.0
hooks:
- id: ansible-lint
# files: molecule/default/playbook.yml
additional_dependencies:
# On its own ansible-lint does not pull in ansible, only
# ansible-core. Therefore, if an Ansible module lives in
# ansible instead of ansible-core, the linter will complain
# that the module is unknown. In these cases it is
# necessary to add the ansible package itself as an
# additional dependency, with the same pinning as is done in
# requirements-test.txt of cisagov/skeleton-ansible-role.
# - ansible>=9,<10
# ansible-core 2.16.3 through 2.16.6 suffer from the bug
# discussed in ansible/ansible#82702, which breaks any
# symlinked files in vars, tasks, etc. for any Ansible role
# installed via ansible-galaxy. Hence we never want to
# install those versions.
#
# Note that any changes made to this dependency must also be
# made in requirements.txt in cisagov/skeleton-packer and
# requirements-test.txt in cisagov/skeleton-ansible-role.
- ansible-core>=2.16.7

# Terraform hooks
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.0
rev: v1.90.0
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand Down
16 changes: 6 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@
# often breaking changes across major versions. This is the reason
# for the upper bound.
ansible>=8,<10
# TODO: Remove this pin when possible. See
# cisagov/skeleton-packer#312 for more details.
#
# ansible-core 2.16.3 and later suffer from the bug discussed in
# ansible-core 2.16.3 through 2.16.6 suffer from the bug discussed in
# ansible/ansible#82702, which breaks any symlinked files in vars,
# tasks, etc. for any Ansible role installed via ansible-galaxy.
# Hence we never want to install those versions.
#
# See also cisagov/skeleton-ansible-role#178 and
# cisagov/skeleton-generic#180. Note from these PRs that any changes
# made to this dependency must also be made in requirements-test.txt
# in cisagov/skeleton-ansible-role and .pre-commit-config.yaml in
# cisagov/skeleton-generic.
ansible-core<2.16.3
# Note that any changes made to this dependency must also be made in
# requirements-test.txt in cisagov/skeleton-ansible-role and
# .pre-commit-config.yaml in cisagov/skeleton-generic.
ansible-core>=2.16.7
boto3
docopt
semver
Expand Down
71 changes: 66 additions & 5 deletions src/packer.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,21 @@ variable "skip_create_ami" {
type = bool
}

data "amazon-ami" "ubuntu_server_noble" {
data "amazon-ami" "ubuntu_server_noble_arm64" {
filters = {
architecture = "arm64"
name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64-server*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"]
region = var.build_region
}

data "amazon-ami" "ubuntu_server_noble_x86_64" {
filters = {
architecture = "x86_64"
name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server*"
root-device-type = "ebs"
virtualization-type = "hvm"
Expand All @@ -76,7 +89,51 @@ data "amazon-ami" "ubuntu_server_noble" {

locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }

source "amazon-ebs" "ubuntu_server" {
source "amazon-ebs" "arm64" {
ami_name = "ubuntu-server-hvm-${local.timestamp}-arm64-ebs"
ami_regions = var.ami_regions
associate_public_ip_address = true
encrypt_boot = true
instance_type = "t4g.small"
kms_key_id = var.build_region_kms
launch_block_device_mappings {
delete_on_termination = true
device_name = "/dev/xvda"
encrypted = true
volume_size = 8
volume_type = "gp3"
}
region = var.build_region
region_kms_key_ids = var.region_kms_keys
skip_create_ami = var.skip_create_ami
source_ami = data.amazon-ami.ubuntu_server_noble_arm64.id
ssh_username = "ubuntu"
subnet_filter {
filters = {
"tag:Name" = "AMI Build"
}
}
tags = {
Application = "Ubuntu Server"
Architecture = "arm64"
Base_AMI_Name = data.amazon-ami.ubuntu_server_noble_arm64.name
GitHub_Release_URL = var.release_url
OS_Version = "Ubuntu Noble Numbat"
Pre_Release = var.is_prerelease
Release = var.release_tag
Team = "VM Fusion - Development"
}
# Many Linux distributions are now disallowing the use of RSA keys,
# so it makes sense to use an ED25519 key instead.
temporary_key_pair_type = "ed25519"
vpc_filter {
filters = {
"tag:Name" = "AMI Build"
}
}
}

source "amazon-ebs" "x86_64" {
ami_name = "ubuntu-server-hvm-${local.timestamp}-x86_64-ebs"
ami_regions = var.ami_regions
associate_public_ip_address = true
Expand All @@ -93,7 +150,7 @@ source "amazon-ebs" "ubuntu_server" {
region = var.build_region
region_kms_key_ids = var.region_kms_keys
skip_create_ami = var.skip_create_ami
source_ami = data.amazon-ami.ubuntu_server_noble.id
source_ami = data.amazon-ami.ubuntu_server_noble_x86_64.id
ssh_username = "ubuntu"
subnet_filter {
filters = {
Expand All @@ -102,7 +159,8 @@ source "amazon-ebs" "ubuntu_server" {
}
tags = {
Application = "Ubuntu Server"
Base_AMI_Name = data.amazon-ami.ubuntu_server_noble.name
Architecture = "x86_64"
Base_AMI_Name = data.amazon-ami.ubuntu_server_noble_x86_64.name
GitHub_Release_URL = var.release_url
OS_Version = "Ubuntu Noble Numbat"
Pre_Release = var.is_prerelease
Expand All @@ -120,7 +178,10 @@ source "amazon-ebs" "ubuntu_server" {
}

build {
sources = ["source.amazon-ebs.ubuntu_server"]
sources = [
"source.amazon-ebs.arm64",
"source.amazon-ebs.x86_64",
]

# We are adding this to avoid the failure to install aptitude during build time
# Issue #12 has been created for this.
Expand Down
2 changes: 1 addition & 1 deletion src/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.4.0"
__version__ = "1.5.0-rc.1"
Loading
Loading