fleet/.github/workflows/push-osquery-perf-to-ecr.yml
Guillaume Ross b94972351f
Adding permissions to some workflows (#4698)
* Adding permissions to docs.yml and integration.yml

* Update codeql-analysis.yml

Adding top level read permissions to codeql workflow

* Update codeql-analysis.yml

Adding manual dispatch to codeql - to be able to test it easier

* Update deploy-fleet-website.yml

Adding top level read permission + write in the job so it can push the website

* Update test-website.yml

test-website should only need read permissions on content.

* Update fleet-and-orbit.yml

Testing Fleet and Orbit should be fine with top level read access

* Update fleetctl-preview.yml

fleetctl-preview should be fine with just read access at top level

* Update push-osquery-perf-to-ecr.yml

ECR is out of github so read permissions should be enough

* Update semgrep-analysis.yml

semgrep should only need read

* Update test-packaging.yml

Should only need read permission - setting on top

* Update test.yml

Should not need any write access - setting to READ on top.

* Update deploy-fleet-website.yml

Removing git write permission - since this pushes to Heroku not GitHub

* Tweaked as per Zach's comments

Removed some useless restrictions (contents none on a public repo for example)

* Removed meaningless permissions

contents: none - this does not have any security advantage on a public repo
2022-03-25 14:19:42 -04:00

49 lines
1.7 KiB
YAML

name: Build docker image and publish to ECR
on:
workflow_dispatch:
inputs:
enroll_secret:
description: 'Enroll Secret'
required: true
url:
description: 'Fleet server URL'
required: true
host_count:
description: 'Amount of hosts to emulate'
required: true
default: 20
tag:
description: 'docker image tag'
required: true
default: latest
permissions:
contents: read
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@05b148adc31e091bafbaf404f745055d4d3bc9d2 # v1
with:
aws-access-key-id: ${{ secrets.LOADTEST_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.LOADTEST_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@aaf69d68aa3fb14c1d5a6be9ac61fe15b48453a2 # v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: osquery-perf
IMAGE_TAG: ${{ github.event.inputs.tag }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg ENROLL_SECRET=${{ github.event.inputs.enroll_secret }} --build-arg HOST_COUNT=${{ github.event.inputs.host_count }} --build-arg SERVER_URL=${{ github.event.inputs.url }} -f Dockerfile.osquery-perf .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG