Skip to content

Commit

Permalink
[IT-3523] Run the deploy for test branches
Browse files Browse the repository at this point in the history
Run the deploy pipeline for pushes to branches that start with `test/`
to automate the creation of test artifacts and streamline the manual
testing process.

Pushing directly to a branch requires write permission to the repo,
restricting who can create a test artifact.
  • Loading branch information
ConsoleCatzirl committed Dec 12, 2024
1 parent 8aeda7a commit 6af1df1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
deploy:
name: Deploy to AWS org-sagebase-imagecentral
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/test/') || startsWith(github.ref, 'refs/tags/v') }}
needs: [ "validate" ]
permissions:
id-token: write
Expand Down
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,25 @@ source_profile = jsmith@imagecentral

Now you will be able to build an image and deploy it to Imagecentral.

### Image Accessability
This project is setup to build publicly accessible images. To change it to
build private images please refer to the [packer documentation](https://packer.io/docs/builders/amazon-ebs.html)
for `ami_users` and `snapshot_users`options.

### Testing
As a pre-deployment step we syntatically validate our packer json
files with [pre-commit](https://pre-commit.com).

Please install pre-commit, once installed the file validations will
automatically run on every commit. Alternatively you can manually
execute the validations by running `pre-commit run --all-files`.

### Manual AMI Build
If you would like to test building an AMI run:
```
cd src
packer plugins install github.com/hashicorp/amazon
packer plugins install github.com/hashicorp/ansible
AWS_PROFILE=packer-service-imagecentral AWS_DEFAULT_REGION=us-east-1 packer build -var AmiImageName=my-test-image -var PACKER_LOG=1 template.json
```

Expand All @@ -56,19 +71,10 @@ Packer will do the following:
__Notes__:
* Packer deploys a new AMI to the AWS account specified by the AwsProfile
* Subsequent builds may require the [-force](https://packer.io/docs/commands/build.html#force) flag
* Test AMIs can be built automatically by pushing directly to a branch beginning with `test/`

### Image Accessability
This project is setup to build publicly accessible images. To change it to
build private images please refer to the [packer documentation](https://packer.io/docs/builders/amazon-ebs.html)
for `ami_users` and `snapshot_users`options.

### Testing
As a pre-deployment step we syntatically validate our packer json
files with [pre-commit](https://pre-commit.com).

Please install pre-commit, once installed the file validations will
automatically run on every commit. Alternatively you can manually
execute the validations by running `pre-commit run --all-files`.
The process for testing the integration of an AMI with cloudformation init scripts
is outlined in the [`organizations-infra` docs for service catalog](https://github.com/Sage-Bionetworks-IT/organizations-infra/blob/master/sceptre/scipool/README.md)

### CI Workflow
The workflow to provision AWS AMI is done using pull requests.
Expand Down

0 comments on commit 6af1df1

Please sign in to comment.