stdlib: cue fmt

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-03-18 15:54:53 -07:00
parent abdcb7e093
commit 13fa947062
4 changed files with 62 additions and 66 deletions

View File

@ -1 +0,0 @@
module: ""

View File

@ -1 +0,0 @@
../../../../stdlib

View File

@ -46,51 +46,49 @@ import (
outputs: [string]: string
outputs: {
#compute: [
llb.#Load & {
from: aws.#CLI
},
llb.#Mkdir & {
path: "/src"
},
for dest, content in #files {
llb.#WriteFile & {
"dest": dest
"content": content
outputs: #compute: [
llb.#Load & {
from: aws.#CLI
},
llb.#Mkdir & {
path: "/src"
},
for dest, content in #files {
llb.#WriteFile & {
"dest": dest
"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"
}
},
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
TIMEOUT: "\(timeout)"
ON_FAILURE: onFailure
}
dir: "/src"
mount: "/cache/aws": "cache"
},
llb.#Export & {
source: "/outputs.json"
format: "json"
},
]
}
STACK_NAME: stackName
TIMEOUT: "\(timeout)"
ON_FAILURE: onFailure
}
dir: "/src"
mount: "/cache/aws": "cache"
},
llb.#Export & {
source: "/outputs.json"
format: "json"
},
]
}

View File

@ -1,26 +1,26 @@
package eks
#Code: #"""
[ -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
}
[ -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
}
export KUBECONFIG=/kubeconfig
export PATH="$PATH:/cache/bin"
export KUBECONFIG=/kubeconfig
export PATH="$PATH:/cache/bin"
# Generate a kube configuration
aws eks update-kubeconfig --name "$EKS_CLUSTER"
# Generate a kube configuration
aws eks update-kubeconfig --name "$EKS_CLUSTER"
# Figure out the kubernetes username
CONTEXT="$(kubectl config current-context)"
USER="$(kubectl config view -o json | \
jq -r ".contexts[] | select(.name==\"$CONTEXT\") | .context.user")"
# Figure out the kubernetes username
CONTEXT="$(kubectl config current-context)"
USER="$(kubectl config view -o json | \
jq -r ".contexts[] | select(.name==\"$CONTEXT\") | .context.user")"
# Grab a kubernetes access token
ACCESS_TOKEN="$(aws eks get-token --cluster-name "$EKS_CLUSTER" | \
jq -r .status.token)"
# Grab a kubernetes access token
ACCESS_TOKEN="$(aws eks get-token --cluster-name "$EKS_CLUSTER" | \
jq -r .status.token)"
# Remove the user config and replace it with the token
kubectl config unset "users.${USER}"
kubectl config set-credentials "$USER" --token "$ACCESS_TOKEN"
"""#
# Remove the user config and replace it with the token
kubectl config unset "users.${USER}"
kubectl config set-credentials "$USER" --token "$ACCESS_TOKEN"
"""#