Skip to content

Instantly share code, notes, and snippets.

View manekinekko's full-sized avatar
:octocat:
Check me out on BlueSky @wassim.dev

Wassim Chegham manekinekko

:octocat:
Check me out on BlueSky @wassim.dev
View GitHub Profile
{
search(first: 1, type: ISSUE, query: "type:pr repo:REPO_NAME COMMIT_SHA") {
nodes {
... on PullRequest {
id
}
}
}
}
@manekinekko
manekinekko / github-create-comment.sh
Created November 13, 2018 13:15
Create a comment on the xlayers/xlayers GitHub project, using the GraphQL API
#!/bin/bash
set -u
access_token=$GITHUB_ACCESS_TOKEN
subject_json=$(curl --url "https://api.github.com/graphql?access_token=$access_token" \
--header 'content-type: application/json' \
--data "{ \"query\": \"{ search(first: 1, type: ISSUE, query: \\\"type:pr repo:xlayers/xlayers $COMMIT_SHA\\\") { nodes { ... on PullRequest { id, number, title } } } }\" }")
@manekinekko
manekinekko / cloudbuild.preview-link.yaml
Last active November 13, 2018 15:53
Google Cloud Build config file for xlayers.app (create Github comment)
echo -n "cb09******************" | \
gcloud kms encrypt \
--plaintext-file=- \
--ciphertext-file=- \
--location=global \
--keyring=GITHUB_ACCESS_TOKEN \
--key=GITHUB_ACCESS_TOKEN | \
base64
# Output:
@manekinekko
manekinekko / gcp-kms-decryption-grant.sh
Created November 13, 2018 11:46
Grant Decryption permission for Cloud Builds for the GITHUB_ACCESS_TOKEN key-ring
gcloud kms keys add-iam-policy-binding \
GITHUB_ACCESS_TOKEN --location=global --keyring=GITHUB_ACCESS_TOKEN \
--member=serviceAccount:[email protected] \
--role=roles/cloudkms.cryptoKeyEncrypterDecrypter
@manekinekko
manekinekko / kubernetes.deployment.yaml
Created October 29, 2018 16:46
Google Cloud Build config file for xlayers.app (CD) — kubernetes.deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: xlayers-_SHORT_SHA_
spec:
selector:
matchLabels:
app: xlayers-_SHORT_SHA_
template:
metadata:
@manekinekko
manekinekko / kubernetes.service.yaml
Created October 29, 2018 16:45
Google Cloud Build config file for xlayers.app (CD) — kubernetes.service.yaml
apiVersion: v1
kind: Service
metadata:
name: xlayers-_SHORT_SHA_
spec:
ports:
- port: 80
selector:
app: xlayers-_SHORT_SHA_
@manekinekko
manekinekko / kubernetes.ingress.yaml
Created October 29, 2018 16:44
Google Cloud Build config file for xlayers.app (CD) — kubernetes.ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-_SHORT_SHA_
annotations:
kubernetes.io/ingress.class: "nginx"
# make sure the controller redirects (301) to HTTPS
ingress.kubernetes.io/ssl-redirect: "true"
@manekinekko
manekinekko / nginx.conf
Created October 29, 2018 12:19
Google Cloud Build config file for xlayers.app (CI only) — nginx.conf
server {
listen 80;
charset utf-8;
sendfile on;
root /usr/share/nginx/html;
location / {
expires -1;
add_header Pragma "no-cache";
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
@manekinekko
manekinekko / Dockerfile
Created October 29, 2018 12:17
Google Cloud Build config file for xlayers.app (CI only) — Dockerfile
FROM nginx:latest
COPY scripts/cloudbuild/ngcontainer/nginx.conf /etc/nginx/conf.d/default.conf
COPY dist/html /usr/share/nginx/html