stdlib: cue fmt
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
abdcb7e093
commit
13fa947062
@ -1 +0,0 @@
|
|||||||
module: ""
|
|
@ -1 +0,0 @@
|
|||||||
../../../../stdlib
|
|
@ -46,51 +46,49 @@ import (
|
|||||||
|
|
||||||
outputs: [string]: string
|
outputs: [string]: string
|
||||||
|
|
||||||
outputs: {
|
outputs: #compute: [
|
||||||
#compute: [
|
llb.#Load & {
|
||||||
llb.#Load & {
|
from: aws.#CLI
|
||||||
from: aws.#CLI
|
},
|
||||||
},
|
llb.#Mkdir & {
|
||||||
llb.#Mkdir & {
|
path: "/src"
|
||||||
path: "/src"
|
},
|
||||||
},
|
for dest, content in #files {
|
||||||
for dest, content in #files {
|
llb.#WriteFile & {
|
||||||
llb.#WriteFile & {
|
"dest": dest
|
||||||
"dest": dest
|
"content": content
|
||||||
"content": content
|
}
|
||||||
|
},
|
||||||
|
llb.#Exec & {
|
||||||
|
args: [
|
||||||
|
"/bin/bash",
|
||||||
|
"--noprofile",
|
||||||
|
"--norc",
|
||||||
|
"-eo",
|
||||||
|
"pipefail",
|
||||||
|
"/entrypoint.sh",
|
||||||
|
]
|
||||||
|
env: {
|
||||||
|
AWS_CONFIG_FILE: "/cache/aws/config"
|
||||||
|
AWS_ACCESS_KEY_ID: config.accessKey
|
||||||
|
AWS_SECRET_ACCESS_KEY: config.secretKey
|
||||||
|
AWS_DEFAULT_REGION: config.region
|
||||||
|
AWS_REGION: config.region
|
||||||
|
AWS_DEFAULT_OUTPUT: "json"
|
||||||
|
AWS_PAGER: ""
|
||||||
|
if neverUpdate {
|
||||||
|
NEVER_UPDATE: "true"
|
||||||
}
|
}
|
||||||
},
|
STACK_NAME: stackName
|
||||||
llb.#Exec & {
|
TIMEOUT: "\(timeout)"
|
||||||
args: [
|
ON_FAILURE: onFailure
|
||||||
"/bin/bash",
|
}
|
||||||
"--noprofile",
|
dir: "/src"
|
||||||
"--norc",
|
mount: "/cache/aws": "cache"
|
||||||
"-eo",
|
},
|
||||||
"pipefail",
|
llb.#Export & {
|
||||||
"/entrypoint.sh",
|
source: "/outputs.json"
|
||||||
]
|
format: "json"
|
||||||
env: {
|
},
|
||||||
AWS_CONFIG_FILE: "/cache/aws/config"
|
]
|
||||||
AWS_ACCESS_KEY_ID: config.accessKey
|
|
||||||
AWS_SECRET_ACCESS_KEY: config.secretKey
|
|
||||||
AWS_DEFAULT_REGION: config.region
|
|
||||||
AWS_REGION: config.region
|
|
||||||
AWS_DEFAULT_OUTPUT: "json"
|
|
||||||
AWS_PAGER: ""
|
|
||||||
if neverUpdate {
|
|
||||||
NEVER_UPDATE: "true"
|
|
||||||
}
|
|
||||||
STACK_NAME: stackName
|
|
||||||
TIMEOUT: "\(timeout)"
|
|
||||||
ON_FAILURE: onFailure
|
|
||||||
}
|
|
||||||
dir: "/src"
|
|
||||||
mount: "/cache/aws": "cache"
|
|
||||||
},
|
|
||||||
llb.#Export & {
|
|
||||||
source: "/outputs.json"
|
|
||||||
format: "json"
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
package eks
|
package eks
|
||||||
|
|
||||||
#Code: #"""
|
#Code: #"""
|
||||||
[ -e /cache/bin/kubectl ] || {
|
[ -e /cache/bin/kubectl ] || {
|
||||||
curl -sfL https://dl.k8s.io/v1.19.9/bin/linux/amd64/kubectl -o /cache/bin/kubectl && chmod +x /cache/bin/kubectl
|
curl -sfL https://dl.k8s.io/v1.19.9/bin/linux/amd64/kubectl -o /cache/bin/kubectl && chmod +x /cache/bin/kubectl
|
||||||
}
|
}
|
||||||
|
|
||||||
export KUBECONFIG=/kubeconfig
|
export KUBECONFIG=/kubeconfig
|
||||||
export PATH="$PATH:/cache/bin"
|
export PATH="$PATH:/cache/bin"
|
||||||
|
|
||||||
# Generate a kube configuration
|
# Generate a kube configuration
|
||||||
aws eks update-kubeconfig --name "$EKS_CLUSTER"
|
aws eks update-kubeconfig --name "$EKS_CLUSTER"
|
||||||
|
|
||||||
# Figure out the kubernetes username
|
# Figure out the kubernetes username
|
||||||
CONTEXT="$(kubectl config current-context)"
|
CONTEXT="$(kubectl config current-context)"
|
||||||
USER="$(kubectl config view -o json | \
|
USER="$(kubectl config view -o json | \
|
||||||
jq -r ".contexts[] | select(.name==\"$CONTEXT\") | .context.user")"
|
jq -r ".contexts[] | select(.name==\"$CONTEXT\") | .context.user")"
|
||||||
|
|
||||||
# Grab a kubernetes access token
|
# Grab a kubernetes access token
|
||||||
ACCESS_TOKEN="$(aws eks get-token --cluster-name "$EKS_CLUSTER" | \
|
ACCESS_TOKEN="$(aws eks get-token --cluster-name "$EKS_CLUSTER" | \
|
||||||
jq -r .status.token)"
|
jq -r .status.token)"
|
||||||
|
|
||||||
# Remove the user config and replace it with the token
|
# Remove the user config and replace it with the token
|
||||||
kubectl config unset "users.${USER}"
|
kubectl config unset "users.${USER}"
|
||||||
kubectl config set-credentials "$USER" --token "$ACCESS_TOKEN"
|
kubectl config set-credentials "$USER" --token "$ACCESS_TOKEN"
|
||||||
"""#
|
"""#
|
||||||
|
Reference in New Issue
Block a user