-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
# Tiltfile looks like: | ||
# os. putenv ( 'DOCKER_USERNAME' , 'registry-user' ) | ||
# os. putenv ( 'DOCKER_PASSWORD' , 'password' ) | ||
# os. putenv ( 'DOCKER_EMAIL' , 'none@example.org' ) | ||
# os. putenv ( 'DOCKER_REGISTRY' , 'registry.example.org' ) | ||
# Namespace='sandbox-hcfp' | ||
# os.putenv('NAMESPACE',Namespace) | ||
# allow_k8s_contexts('kubernetes-admin') | ||
# k8s_yaml(helm('./k8s/helm/hcfmailerplus', name='hcfmailer-plus', namespace=Namespace, values='dev-values.yaml')) | ||
# custom_build('highcanfly/hcfmailer-plus','./kaniko-build.sh',['./autocert', './scripts'],skips_local_docker=True) | ||
|
||
#kubectl create secret generic registry-credentials --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson | ||
# | ||
# EXPECTED_REF=serveur/highcanfly_hcfmailer-plus:tilt-build-1683738819 | ||
# EXPECTED_IMAGE=highcanfly_hcfmailer-plus | ||
# EXPECTED_TAG=tilt-build-1683738819 | ||
# REGISTRY_HOST=server.fqdn | ||
# EXPECTED_REGISTRY=server.fqdn | ||
echo "NAMESPACE=$NAMESPACE" | ||
KANIKO_POD=$(kubectl -n $NAMESPACE get pods | grep "kaniko" | cut -d' ' -f1) | ||
BAD_RANDOM=$(echo $RANDOM-$RANDOM-$RANDOM-$RANDOM | openssl dgst -sha1 ) | ||
echo "Random seed is $BAD_RANDOM" | ||
kubectl create namespace $NAMESPACE | ||
#kubectl create -n $NAMESPACE secret generic ssh-key-secret --from-file=ssh-privatekey=$HOME/.ssh/id_ecdsa --from-file=ssh-publickey=$HOME/.ssh/id_ecdsa.pub --from-literal=ssh-key-type=ecdsa | ||
echo "CURRENT KANIKO POD is kaniko-$BAD_RANDOM" | ||
kubectl -n $NAMESPACE delete pod --wait=false $KANIKO_POD 2>/dev/null | ||
tar -cv --exclude "node_modules" --exclude "dkim.rsa" --exclude "private" --exclude "k8s" --exclude ".git" --exclude ".github" --exclude-vcs --exclude ".docker" --exclude "_sensitive_datas" -f - . | gzip -9 | kubectl run -n $NAMESPACE kaniko-$BAD_RANDOM \ | ||
--rm --stdin=true \ | ||
--image=highcanfly/kaniko:latest --restart=Never \ | ||
--overrides='{ | ||
"apiVersion": "v1", | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"name": "kaniko", | ||
"image": "highcanfly/kaniko:latest", | ||
"imagePullPolicy": "Always", | ||
"stdin": true, | ||
"stdinOnce": true, | ||
"args": [ | ||
"-v","info", | ||
"--build-arg","MSVC_ARCH=x86", | ||
"--build-arg","LLVM_ARCH=i686", | ||
"--cache=false", | ||
"--dockerfile=Dockerfile'$EXT'", | ||
"--context=tar://stdin", | ||
"--skip-tls-verify", | ||
"--destination='$EXPECTED_REF'", | ||
"--image-fs-extract-retry=3", | ||
"--push-retry=3", | ||
"--single-snapshot" | ||
] | ||
} | ||
], | ||
"restartPolicy": "Never" | ||
} | ||
}' | ||
|
||
#kubectl delete -n $NAMESPACE secret/registry-credentials |
This file contains 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