This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
redis: | |
image: redis | |
web: | |
image: radumatei/initial-scaleout | |
deploy: | |
mode: replicated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
invocation_id:"71ce7295-741e-4d7b-9270-acca0a2a49ae" | |
function_id:"dbabbc49-22c0-422a-b34e-b8a6dd8b0078" | |
input_data:<name:"req" | |
data:< | |
http:< | |
method:"GET" | |
url:"/api/HttpTriggerGo" | |
headers:< | |
key:"accept" | |
value:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"callback_url": "https://registry.hub.docker.com/u/svendowideit/testhook/hook/2141b5bi5i5b02bec211i4eeih0242eg11000a/", | |
"push_data": { | |
"images": [ | |
"27d47432a69bca5f2700e4dff7de0388ed65f9d3fb1ec645e2bc24c223dc1cc3", | |
"51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c", | |
"..." | |
], | |
"pushed_at": 1.417566161e+09, | |
"pusher": "trustedbuilder", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WebhookData struct is the data sent from Docker Hub webhooks | |
type WebhookData struct { | |
PushData struct { | |
PushedAt int `json:"pushed_at"` | |
Images []string `json:"images"` | |
Tag string `json:"tag"` | |
Pusher string `json:"pusher"` | |
} `json:"push_data"` | |
CallbackURL string `json:"callback_url"` | |
Repository struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getContainerGroupsClient() (containerinstance.ContainerGroupsClient, error) { | |
var containerGroupsClient containerinstance.ContainerGroupsClient | |
oAuthConfig, err := adal.NewOAuthConfig(defaultActiveDirectoryEndpoint, tenantID) | |
if err != nil { | |
return containerGroupsClient, fmt.Errorf("cannot get oAuth configuration: %v", err) | |
} | |
token, err := adal.NewServicePrincipalToken(*oAuthConfig, clientID, clientSecret, defaultResourceManagerEndpoint) | |
if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func updateAzureContainer(resourceGroupName, containerGroupName string, webhookData WebhookData) error { | |
containerGroupsClient, err := getContainerGroupsClient() | |
if err != nil { | |
return fmt.Errorf("cannot get container groups client: %v", err) | |
} | |
containerGroup, err := containerGroupsClient.Get(resourceGroupName, containerGroupName) | |
if err != nil { | |
return fmt.Errorf("cannot get container group: %v", err) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func handleWebhook(w http.ResponseWriter, r *http.Request) { | |
decoder := json.NewDecoder(r.Body) | |
var webhookData WebhookData | |
err := decoder.Decode(&webhookData) | |
if err != nil { | |
log.Printf("cannot decode request body: %v", err) | |
} | |
defer r.Body.Close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
invocation_id:\"bc37cc22-c224-47f2-9c91-958f5387604d\" | |
function_id:\"d208f451-a62b-4603-90d1-ff2d66fb37c4\" | |
input_data:< | |
name:\"myBlob\" | |
data:< | |
string:\"blob content...\\n\" | |
> | |
> | |
trigger_metadata:< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package rpc; | |
service KTK { | |
rpc GetVersion(Empty) returns (Version){} | |
rpc ServerStream(Empty) returns(stream StreamingMessage){} | |
} | |
message Version { | |
string sem_ver = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs = require('fs'); | |
import { Observable } from 'rxjs'; | |
let exec = require('child_process').exec; | |
const git_commit = new Observable<string>(s => { | |
exec('git rev-parse HEAD', | |
function (error: Error, stdout: Buffer, stderr: Buffer) { | |
if (error !== null) { | |
console.log('git error: ' + error + stderr); |