Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/release-dev.build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: '1.23'

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-dev.create-release-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Delete Release
uses: dev-drprasad/delete-tag-and-release@v0.2.1
Expand Down Expand Up @@ -45,12 +45,12 @@ jobs:

- name: Create Github Release
id: create_release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: 0.0.0-dev
release_name: Dev Release
name: Dev Release
prerelease: true
body: |
Most recent dev release
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-prod.build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
go-version: '1.23'

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -63,10 +63,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Checkout homebrew-ize repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: hazelops/homebrew-ize # Ize homebrew repo
path: ${{ github.workspace }}/homebrew-ize # Local folder to copy file
Expand Down
36 changes: 21 additions & 15 deletions .github/workflows/run.e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18.x

- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build
run: |
go mod download
make bin

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ize-${{ matrix.os }}-${{ github.sha }}
path: ${{ github.workspace }}/ize
Expand All @@ -62,24 +62,26 @@ jobs:
echo "ENV=${{ github.job }}-$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: ${{ env.AWS_REGION }}
env:
AWS_PROFILE: # This is required due to a bug https://stackoverflow.com/a/77731682

- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18.x

- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Prepare Test Environment
run: mv "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/testnut" "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/${{ env.ENV }}"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ize-${{ matrix.os }}-${{ github.sha }}
path: bin
Expand Down Expand Up @@ -126,24 +128,26 @@ jobs:
echo "ENV=${{ github.job }}-$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: ${{ env.AWS_REGION }}
env:
AWS_PROFILE: # This is required due to a bug https://stackoverflow.com/a/77731682

- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18.x

- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Prepare Test Environment
run: mv "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/testnut" "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/${{ env.ENV }}"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ize-${{ matrix.os }}-${{ github.sha }}
path: bin
Expand Down Expand Up @@ -197,24 +201,26 @@ jobs:
echo "ENV=${{ github.job }}-$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: ${{ env.AWS_REGION }}
env:
AWS_PROFILE: # This is required due to a bug https://stackoverflow.com/a/77731682

- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18.x

- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Prepare Test Environment
run: mv "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/testnut" "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/${{ env.ENV }}"

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ize-${{ matrix.os }}-${{ github.sha }}
path: bin
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/run.unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18.x

- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build
run: |
go mod download
make bin

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ize-${{ matrix.os }}-${{ github.sha }}
path: ${{ github.workspace }}/ize
Expand All @@ -51,10 +51,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.18

Expand Down Expand Up @@ -90,4 +90,4 @@ jobs:
report_paths: './report.xml'

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
4 changes: 2 additions & 2 deletions examples/bastion-tunnel-monorepo/.ize/env/testnut/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module "vpc" {

module "nat_instance" {
source = "hazelops/ec2-nat/aws"
version = "~> 2.0"
version = "~> 3.0"
enabled = true
env = var.env
vpc_id = module.vpc.vpc_id
Expand Down Expand Up @@ -79,7 +79,7 @@ module "ec2_profile" {

module "bastion" {
source = "hazelops/ec2-openvpn-connector/aws"
version = "~>0.2"
version = "~> 0.4"

vpn_enabled = false
env = var.env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
version = "~> 4.0"
}
}
required_version = ">= 0.13"
Expand Down
2 changes: 1 addition & 1 deletion examples/ecs-apps-monorepo/.ize/env/testnut/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.0"
version = "~> 4.0"
}
}
required_version = ">= 0.13"
Expand Down
2 changes: 1 addition & 1 deletion examples/sls-apps-monorepo/.ize/env/testnut/pecan.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "pecan" {
source = "registry.terraform.io/hazelops/sls-app/aws"
version = "~> 0.2"
version = "0.2.1"
name = "pecan"
parameters = {
ROOT_DOMAIN_NAME = var.root_domain_name
Expand Down
2 changes: 1 addition & 1 deletion examples/sls-apps-monorepo/.ize/env/testnut/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.0"
version = "~> 4.0"
}
}
required_version = ">= 0.13"
Expand Down
16 changes: 0 additions & 16 deletions internal/config/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ type Ecs struct {
DependsOn []string `mapstructure:"depends_on,omitempty"`
}

type K8s struct {
Name string `mapstructure:",omitempty"`
Path string `mapstructure:",omitempty"`
Image string `mapstructure:",omitempty"`
Cluster string `mapstructure:",omitempty"`
TaskDefinitionRevision string `mapstructure:"task_definition_revision"`
DockerRegistry string `mapstructure:"docker_registry,omitempty"`
Timeout int `mapstructure:",omitempty"`
Unsafe bool `mapstructure:",omitempty"`
SkipDeploy bool `mapstructure:"skip_deploy,omitempty"`
Icon string `mapstructure:"icon,omitempty"`
AwsProfile string `mapstructure:"aws_profile,omitempty"`
AwsRegion string `mapstructure:"aws_region,omitempty"`
DependsOn []string `mapstructure:"depends_on,omitempty"`
}

type Serverless struct {
Name string `mapstructure:",omitempty"`
File string `mapstructure:",omitempty"`
Expand Down
27 changes: 19 additions & 8 deletions internal/manager/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ func (e *Manager) prepare() {
}
}

// getPlatform returns the platform to use for Docker builds and pushes.
// Priority: PreferRuntime=docker-arm64 (backward compatibility) > DOCKER_DEFAULT_PLATFORM env var > default (linux/amd64)
func (e *Manager) getPlatform() string {
// First, check PreferRuntime for backward compatibility with existing configs
if e.Project.PreferRuntime == "docker-arm64" {
return "linux/arm64"
}

// Then check DOCKER_DEFAULT_PLATFORM environment variable
if platform := os.Getenv("DOCKER_DEFAULT_PLATFORM"); platform != "" {
return platform
}

// Default to linux/amd64
return "linux/amd64"
}

// Deploy deploys app container to ECS via ECS deploy
func (e *Manager) Deploy(ui terminal.UI) error {
e.prepare()
Expand Down Expand Up @@ -236,10 +253,7 @@ func (e *Manager) Push(ui terminal.UI) error {

tagLatest := fmt.Sprintf("%s-latest", e.Project.Env)
imageUri := fmt.Sprintf("%s/%s", e.App.DockerRegistry, image)
platform := "linux/amd64"
if e.Project.PreferRuntime == "docker-arm64" {
platform = "linux/arm64"
}
platform := e.getPlatform()

r := docker.NewRegistry(*repository.RepositoryUri, token, platform)

Expand Down Expand Up @@ -293,10 +307,7 @@ func (e *Manager) Build(ui terminal.UI) error {

cache := []string{fmt.Sprintf("%s:%s", imageUri, fmt.Sprintf("%s-latest", e.Project.Env))}

platform := "linux/amd64"
if e.Project.PreferRuntime == "docker-arm64" {
platform = "linux/arm64"
}
platform := e.getPlatform()

b := docker.NewBuilder(
buildArgs,
Expand Down
Loading
Loading