From d22c17beb907b32f7b8847cfd949b5cac5091424 Mon Sep 17 00:00:00 2001 From: Henrique Goncalves Date: Thu, 20 May 2021 08:24:56 -0300 Subject: [PATCH] Add AWS Builder (#707) * add github actions workflows * add marketplace placeholders * minor changes * increment build number * fix yaml * fix build version * make main step uppercase * Update dev.yml * use cache instead of docker hub * load image to docker client * change cache key * minor changes * missing quote * add aws pipeline Co-authored-by: Sebastian Stehle --- .github/workflows/dev.yml | 2 +- .github/workflows/marketplace-aws.yml | 6 +- .github/workflows/marketplace-azure.yml | 2 +- .../workflows/marketplace-digitalocean.yml | 2 +- .github/workflows/marketplace-gcp.yml | 2 +- .github/workflows/marketplace-heroku.yml | 2 +- .github/workflows/marketplace-kubernetes.yml | 2 +- .github/workflows/marketplace-render.yml | 2 +- .github/workflows/marketplace-vultr.yml | 2 +- packer/aws.pkr.hcl | 62 +++++++++++++++++++ 10 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 packer/aws.pkr.hcl diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 85be8d67f..d01d2096c 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -4,7 +4,7 @@ concurrency: dev on: push: branches: - - master + - master - 'release/*' pull_request: branches: diff --git a/.github/workflows/marketplace-aws.yml b/.github/workflows/marketplace-aws.yml index c08f17e26..58f1b97fb 100644 --- a/.github/workflows/marketplace-aws.yml +++ b/.github/workflows/marketplace-aws.yml @@ -3,7 +3,7 @@ concurrency: marketplace-aws on: release: - types: [released] + types: [ released ] jobs: validate: @@ -13,7 +13,6 @@ jobs: uses: actions/checkout@v2 - name: Validate Template - if: false uses: hashicorp/packer-github-actions@master with: command: validate @@ -32,7 +31,6 @@ jobs: uses: rlespinasse/github-slug-action@v3.x - name: Build - if: false uses: hashicorp/packer-github-actions@master with: command: build @@ -41,4 +39,6 @@ jobs: env: PACKER_LOG: 1 PKR_VAR_squidex_version: "${{ env.GITHUB_REF_SLUG }}" + AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" + AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" working-directory: packer/ diff --git a/.github/workflows/marketplace-azure.yml b/.github/workflows/marketplace-azure.yml index 3a439029b..885157103 100644 --- a/.github/workflows/marketplace-azure.yml +++ b/.github/workflows/marketplace-azure.yml @@ -3,7 +3,7 @@ concurrency: marketplace-azure on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/.github/workflows/marketplace-digitalocean.yml b/.github/workflows/marketplace-digitalocean.yml index 1083e7dee..70f59e9f5 100644 --- a/.github/workflows/marketplace-digitalocean.yml +++ b/.github/workflows/marketplace-digitalocean.yml @@ -3,7 +3,7 @@ concurrency: marketplace-digitalocean on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/.github/workflows/marketplace-gcp.yml b/.github/workflows/marketplace-gcp.yml index 5979c3475..1cc8e177c 100644 --- a/.github/workflows/marketplace-gcp.yml +++ b/.github/workflows/marketplace-gcp.yml @@ -3,7 +3,7 @@ concurrency: marketplace-gcp on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/.github/workflows/marketplace-heroku.yml b/.github/workflows/marketplace-heroku.yml index e5ee6dbe3..23b38ed17 100644 --- a/.github/workflows/marketplace-heroku.yml +++ b/.github/workflows/marketplace-heroku.yml @@ -3,7 +3,7 @@ concurrency: marketplace-heroku on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/.github/workflows/marketplace-kubernetes.yml b/.github/workflows/marketplace-kubernetes.yml index a8cb60240..5a69fb164 100644 --- a/.github/workflows/marketplace-kubernetes.yml +++ b/.github/workflows/marketplace-kubernetes.yml @@ -3,7 +3,7 @@ concurrency: marketplace-kubernetes on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/.github/workflows/marketplace-render.yml b/.github/workflows/marketplace-render.yml index e838f7cb6..b5d6478a9 100644 --- a/.github/workflows/marketplace-render.yml +++ b/.github/workflows/marketplace-render.yml @@ -3,7 +3,7 @@ concurrency: marketplace-render on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/.github/workflows/marketplace-vultr.yml b/.github/workflows/marketplace-vultr.yml index 8a0470bd6..a18f18cbf 100644 --- a/.github/workflows/marketplace-vultr.yml +++ b/.github/workflows/marketplace-vultr.yml @@ -3,7 +3,7 @@ concurrency: marketplace-vultr on: release: - types: [released] + types: [ released ] jobs: validate: diff --git a/packer/aws.pkr.hcl b/packer/aws.pkr.hcl new file mode 100644 index 000000000..06a7949a1 --- /dev/null +++ b/packer/aws.pkr.hcl @@ -0,0 +1,62 @@ +variable "squidex_version" { + type = string + default = "5.7.0" +} + +source "amazon-ebs" "aws" { + ami_groups = [ + "all"] + ami_virtualization_type = "hvm" + ami_name = "squidex-${replace(var.squidex_version, ".", "-")}-{{ timestamp }}" + instance_type = "t2.small" + region = "us-east-1" + source_ami_filter { + filters = { + virtualization-type = "hvm" + name = "ubuntu/images/*/ubuntu-focal-20.04-amd64-server-*" + root-device-type = "ebs" + } + owners = [ + "099720109477"] + most_recent = true + } + ssh_username = "ubuntu" + ami_regions = [ + "eu-north-1", + "ap-south-1", + "eu-west-3", + "eu-west-2", + "eu-west-1", + "ap-northeast-3", + "ap-northeast-2", + "ap-northeast-1", + "sa-east-1", + "ca-central-1", + "ap-southeast-1", + "ap-southeast-2", + "eu-central-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ] +} + +build { + sources = [ + "source.amazon-ebs.aws" + ] + + provisioner "ansible" { + ansible_env_vars = [ + "ANSIBLE_HOST_KEY_CHECKING=False", + "ANSIBLE_SSH_ARGS='-F /dev/null -o ForwardAgent=no -o ControlMaster=auto -o ControlPersist=60s'", + "ANSIBLE_NOCOLOR=True" + ] + extra_arguments = [ + "--extra-vars", + "squidex_version=${var.squidex_version}"] + playbook_file = "./ansible/playbook.yml" + use_proxy = false + } +} \ No newline at end of file