Skip to content

Commit

Permalink
fix: Use auth free ingestion endpoint (#51)
Browse files Browse the repository at this point in the history
* used auth free ingestion API.

* Added consumer name in payload.
  • Loading branch information
jparsai authored Jan 26, 2021
1 parent e411c0e commit f250ba3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 0 additions & 5 deletions openshift/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ objects:
key: aws_secret_access_key
- name: REFRESH_INTERVAL
value: "0"
- name: APP_SECRET_KEY
valueFrom:
secretKeyRef:
name: jobs
key: flask-app-secret-key
resources:
requests:
memory: ${MEMORY_REQUEST}
Expand Down
10 changes: 4 additions & 6 deletions src/github_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
_BUCKET = os.environ.get('REPORT_BUCKET_NAME', None)
_TIME_DELTA = int(os.environ.get('REPORT_TIME_DELTA', 0))
_DRY_RUN = int(os.environ.get('DRY_RUN', 0))
_APP_SECRET_KEY = os.getenv('APP_SECRET_KEY', 'not-set')

_SELECTIVE_INGESTION_API_URL = "http://{host}:{port}/{endpoint}".format(
host=os.environ.get("INGESTION_SERVICE_HOST", "bayesian-jobs"),
port=os.environ.get("INGESTION_SERVICE_PORT", "34000"),
endpoint='ingestions/epv-selective')
endpoint='internal/ingestions/epv-selective')

TASK_NAMES = [
'github_details',
Expand Down Expand Up @@ -109,21 +108,20 @@ def schedule_gh_refresh(epv_list):
"packages": [],
"flow_name": "bayesianPackageFlow",
"task_names": TASK_NAMES,
"follow_subflows": True
"follow_subflows": True,
"source": "git-refresh"
}

# Update flow name and task names for Golang.
if eco == 'golang':
payload["flow_name"] = "newPackageAnalysisFlow"
payload["task_names"] = GO_TASK_NAMES

for pkg in epv_list[eco]:
payload['packages'].append({'package': pkg})

if not _DRY_RUN and payload['packages']:
_session.post(url=_SELECTIVE_INGESTION_API_URL,
json=payload,
headers={'auth_token': _APP_SECRET_KEY})
json=payload)
logger.info("Flow is initiated for payload: {}".format(payload))
else:
logger.info("DRY RUN MODE ON..Flow not initiated.")
Expand Down

0 comments on commit f250ba3

Please sign in to comment.