Skip to content

Commit

Permalink
Modify upsertGitHub lambda for local testing in dockstore-deploy (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy-t authored Sep 15, 2023
2 parents bc85af7 + 11d2a17 commit 6eb8130
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 82 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
- create_zip_upload_to_s3:
lambdaFolder: "edge-lambda-for-s3/deployment"
s3BucketFolder: "edgeLambdaForS3404s"
- create_zip_upload_to_s3:
lambdaFolder: "upsertGitHubTag/deployment"
s3BucketFolder: "upsertGitHubTag"
- create_zip_upload_to_s3:
lambdaFolder: "webhook-testing/deployment"
s3BucketFolder: "webhookTesting"
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install aws-sam-cli
- name: Test with SAM CLI
working-directory: ./upsertGitHubTag
run: |
sam local invoke HelloWorldFunction -e events/event.json -n env.json &> output.txt
grep "Valid push event" output.txt
- name: Test wdl parsing with SAM CLI build and invoke
working-directory: ./wdl-parsing
run: |
Expand Down
9 changes: 7 additions & 2 deletions upsertGitHubTag/deployment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const url = require("url");
const https = require("https");
const http = require("http");
const crypto = require("crypto");
const LAMBDA_USER_AGENT = "DockstoreLambda (NodeJs)";
const DELIVERY_ID_HEADER = "X-GitHub-Delivery";
Expand All @@ -25,6 +26,10 @@ const verifyGitHub = (req, payload) => {
);
};

function getProtocol(url) {
return url.protocol === "http:" ? http : https;
}

// Makes a POST request to the given path
function postEndpoint(path, postBody, deliveryId, callback) {
console.log("POST " + path);
Expand All @@ -39,7 +44,7 @@ function postEndpoint(path, postBody, deliveryId, callback) {
"X-GitHub-Delivery": deliveryId,
};

const req = https.request(options, (res) => {
const req = getProtocol(options).request(options, (res) => {
var chunks = [];
var bodyString = "";

Expand Down Expand Up @@ -94,7 +99,7 @@ function deleteEndpoint(
"X-GitHub-Delivery": deliveryId,
};

const req = https.request(options, (res) => {
const req = getProtocol(options).request(options, (res) => {
var chunks = [];

res.on("data", function (chunk) {
Expand Down
5 changes: 0 additions & 5 deletions upsertGitHubTag/env.json

This file was deleted.

21 changes: 0 additions & 21 deletions upsertGitHubTag/events/event.json

This file was deleted.

46 changes: 0 additions & 46 deletions upsertGitHubTag/template.yaml

This file was deleted.

0 comments on commit 6eb8130

Please sign in to comment.