Skip to content

Commit

Permalink
Creating image
Browse files Browse the repository at this point in the history
  • Loading branch information
renatonascimento01 committed Apr 29, 2024
1 parent 1c4870c commit 8137746
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/push-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on: [push]
jobs:
ecr:
runs-on: ubuntu-latest
name: Docker build and push to ECR
env:
## Repository must be in the format '<BU>/<SQUAD>/<PROJECT NAME | MY NAME>'
ECR_REPOSITORY: 'cross/observability/newrelic-migration-exporter'
VERSION: '1.0.0-rc'
steps:
- name: Checkout
uses: actions/checkout@v2
# Exemple of build using docker
- name: Docker Build
run: |
docker build --pull -t ${{ secrets.CONTAINER_REGISTRY_HOST }}/$ECR_REPOSITORY:latest .
docker tag ${{ secrets.CONTAINER_REGISTRY_HOST }}/$ECR_REPOSITORY:latest ${{ secrets.CONTAINER_REGISTRY_HOST }}/$ECR_REPOSITORY:$VERSION
- name: Push to ECR
uses: olxbr/aws-ecr-push-action@v1
id: ecr
with:
# The complete repository name from ECR {BU}/{TEAM}/{PROJECT} (ex. cross/devtools/devtools-scripts).
ecr_repository: 'cross/observability/newrelic-migration-exporter'
# Comma-separated string of ECR image tags (ex. latest, 1.0.0)
tags: 'latest,${{env.VERSION}}'
keep_images: 10
# Warning! Don't change this env values!
# Just copy and paste this whole block as is in your repo
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_CROSS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CROSS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CROSS_SECRET_ACCESS_KEY }}
AWS_PRINCIPAL_RULES: ${{ secrets.AWS_PRINCIPAL_RULES }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python
RUN apt update && apt upgrade
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python", "query_nr.py"]
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build:
docker build -t cross/observability/newrelic-migration-exporter:$(version) .

tag-image:
docker tag newrelic-migration-exporter:$(version) 073521391622.dkr.ecr.us-east-1.amazonaws.com/cross/observability/newrelic-migration-exporter:$(version)

push-image:
docker push 073521391622.dkr.ecr.us-east-1.amazonaws.com/cross/observability/newrelic-migration-exporter:$(version)

release: build tag-image push-image
4 changes: 2 additions & 2 deletions query_nr.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run_nrquery(select_statement):
}}
}}"""
}
response = requests.post(url, headers=headers, json=full_query)
response = requests.post(url, headers=headers, json=full_query, verify=False)
return response.text

def extract_results(json_content):
Expand Down Expand Up @@ -97,4 +97,4 @@ def main():
main()
# import ipdb
# ipdb.set_trace()
time.sleep(100)
time.sleep(120)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
asttokens==2.4.1
certifi==2024.2.2
charset-normalizer==3.3.2
decorator==5.1.1
executing==2.0.1
Expand All @@ -10,6 +9,7 @@ jedi==0.19.1
matplotlib-inline==0.1.7
parso==0.8.4
pexpect==4.9.0
pip-system-certs==4.0
prometheus_client==0.20.0
prompt-toolkit==3.0.43
ptyprocess==0.7.0
Expand All @@ -21,3 +21,4 @@ stack-data==0.6.3
traitlets==5.14.3
urllib3==2.2.1
wcwidth==0.2.13
wrapt==1.16.0

0 comments on commit 8137746

Please sign in to comment.