Skip to content

Commit

Permalink
Login to docker and try to fix virustotal curl commands (stripe#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomer-stripe authored Mar 12, 2021
1 parent dbc4d53 commit bdcc8d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Set up Go
uses: actions/setup-go@v2
with:
Expand All @@ -43,8 +50,6 @@ jobs:
args: release -f .goreleaser/linux.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Upload to Bintray
run: |
scripts/publish-deb-to-bintray.sh
Expand Down
3 changes: 1 addition & 2 deletions .goreleaser/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ nfpms:
dockers:
- goos: linux
goarch: amd64
binaries:
ids:
- stripe
builds:
- stripe-linux
image_templates:
- "stripe/stripe-cli:latest"
Expand Down
6 changes: 3 additions & 3 deletions scripts/upload-zip-to-virustotal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ setVersion () {

downloadWindowsArtifacts() {
echo "Dowloading Windows artifacts..."
FILES=$(curl -s https://api.github.com/repos/stripe/stripe-cli/releases/latest -u $GITHUB_TOKEN: \
FILES=$(curl -s "https://api.github.com/repos/stripe/stripe-cli/releases/latest" -u $GITHUB_TOKEN: \
| jq -r ".assets[].browser_download_url" \
| grep "windows")
echo "$FILES"
Expand All @@ -55,7 +55,7 @@ virustotalUpload () {

echo "Uploading to VirusTotal..."

RESPONSE=$(curl -s https://www.virustotal.com/vtapi/v2/file/scan -X POST -F "apikey=$VIRUSTOTAL_API_KEY" -F "file=@./stripe.exe" -w "HTTPSTATUS:%{http_code}")
RESPONSE=$(curl -s "https://www.virustotal.com/vtapi/v2/file/scan" -X POST -F "apikey=$VIRUSTOTAL_API_KEY" -F "file=@./stripe.exe" -w "HTTPSTATUS:%{http_code}")
BODY=$(echo $RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
RESPONSE_CODE=$(echo $RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')

Expand All @@ -69,7 +69,7 @@ virustotalUpload () {
echo "Adding comment..."

SHA256=$(echo $BODY | jq -r ".sha256")
RESPONSE_CODE=$(curl https://www.virustotal.com/vtapi/v2/comments/put -X POST -d "apikey=$VIRUSTOTAL_API_KEY" -d "resource=$SHA256" -d "comment=Stripe CLI $VERSION, uncompressed from $i" -o /dev/null -w "%{http_code}")
RESPONSE_CODE=$(curl "https://www.virustotal.com/vtapi/v2/comments/put" -X POST -d "apikey=$VIRUSTOTAL_API_KEY" -d "resource=$SHA256" -d "comment=Stripe CLI $VERSION, uncompressed from $i" -o /dev/null -w "%{http_code}")

if [[ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]]; then
echo "Unable to add comment, HTTP response code: $RESPONSE_CODE"
Expand Down

0 comments on commit bdcc8d0

Please sign in to comment.