mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
update
This commit is contained in:
4
cue.mod/pkg/universe.dagger.io/aws/test/config
generated
Executable file
4
cue.mod/pkg/universe.dagger.io/aws/test/config
generated
Executable file
@@ -0,0 +1,4 @@
|
||||
[profile ci]
|
||||
credential_source = Environment
|
||||
region = us-east-2
|
||||
role_arn = arn:aws:iam::125635003186:role/dagger-ci
|
||||
52
cue.mod/pkg/universe.dagger.io/aws/test/config_file.cue
generated
Executable file
52
cue.mod/pkg/universe.dagger.io/aws/test/config_file.cue
generated
Executable file
@@ -0,0 +1,52 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
"universe.dagger.io/aws"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
client: {
|
||||
filesystem: ".": read: {
|
||||
contents: dagger.#FS
|
||||
include: ["config"]
|
||||
}
|
||||
commands: sops: {
|
||||
name: "sops"
|
||||
args: ["-d", "--extract", "[\"AWS\"]", "../../secrets_sops.yaml"]
|
||||
stdout: dagger.#Secret
|
||||
}
|
||||
}
|
||||
|
||||
actions: {
|
||||
sopsSecrets: core.#DecodeSecret & {
|
||||
format: "yaml"
|
||||
input: client.commands.sops.stdout
|
||||
}
|
||||
|
||||
getCallerIdentity: aws.#Container & {
|
||||
always: true
|
||||
configFile: client.filesystem.".".read.contents
|
||||
|
||||
credentials: aws.#Credentials & {
|
||||
accessKeyId: sopsSecrets.output.AWS_ACCESS_KEY_ID.contents
|
||||
secretAccessKey: sopsSecrets.output.AWS_SECRET_ACCESS_KEY.contents
|
||||
}
|
||||
|
||||
command: {
|
||||
name: "sh"
|
||||
flags: "-c": "aws --profile ci sts get-caller-identity > /output.txt"
|
||||
}
|
||||
|
||||
export: files: "/output.txt": _
|
||||
}
|
||||
|
||||
verify: json.Unmarshal(getCallerIdentity.export.files."/output.txt") & {
|
||||
UserId: string
|
||||
Account: =~"^12[0-9]{8}86$"
|
||||
Arn: =~"^arn:aws:sts::(12[0-9]{8}86):assumed-role/dagger-ci"
|
||||
}
|
||||
}
|
||||
}
|
||||
44
cue.mod/pkg/universe.dagger.io/aws/test/credentials.cue
generated
Executable file
44
cue.mod/pkg/universe.dagger.io/aws/test/credentials.cue
generated
Executable file
@@ -0,0 +1,44 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
"universe.dagger.io/aws"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
client: commands: sops: {
|
||||
name: "sops"
|
||||
args: ["-d", "--extract", "[\"AWS\"]", "../../secrets_sops.yaml"]
|
||||
stdout: dagger.#Secret
|
||||
}
|
||||
|
||||
actions: {
|
||||
sopsSecrets: core.#DecodeSecret & {
|
||||
format: "yaml"
|
||||
input: client.commands.sops.stdout
|
||||
}
|
||||
|
||||
getCallerIdentity: aws.#Container & {
|
||||
always: true
|
||||
credentials: aws.#Credentials & {
|
||||
accessKeyId: sopsSecrets.output.AWS_ACCESS_KEY_ID.contents
|
||||
secretAccessKey: sopsSecrets.output.AWS_SECRET_ACCESS_KEY.contents
|
||||
}
|
||||
|
||||
command: {
|
||||
name: "sh"
|
||||
flags: "-c": "aws --region us-east-2 sts get-caller-identity > /output.txt"
|
||||
}
|
||||
|
||||
export: files: "/output.txt": _
|
||||
}
|
||||
|
||||
verify: json.Unmarshal(getCallerIdentity.export.files."/output.txt") & {
|
||||
UserId: string & !~"^$"
|
||||
Account: =~"^12[0-9]{8}86$"
|
||||
Arn: =~"(12[0-9]{8}86)"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
cue.mod/pkg/universe.dagger.io/aws/test/default_version.cue
generated
Executable file
23
cue.mod/pkg/universe.dagger.io/aws/test/default_version.cue
generated
Executable file
@@ -0,0 +1,23 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"universe.dagger.io/aws"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: {
|
||||
build: aws.#Build
|
||||
|
||||
getVersion: docker.#Run & {
|
||||
always: true
|
||||
input: build.output
|
||||
command: {
|
||||
name: "sh"
|
||||
flags: "-c": "aws --version > /output.txt"
|
||||
}
|
||||
export: files: "/output.txt": =~"^aws-cli/\(aws.#DefaultCliVersion)"
|
||||
}
|
||||
}
|
||||
}
|
||||
11
cue.mod/pkg/universe.dagger.io/aws/test/test.bats
generated
Executable file
11
cue.mod/pkg/universe.dagger.io/aws/test/test.bats
generated
Executable file
@@ -0,0 +1,11 @@
|
||||
setup() {
|
||||
load '../../bats_helpers'
|
||||
|
||||
common_setup
|
||||
}
|
||||
|
||||
@test "aws" {
|
||||
dagger "do" -p ./default_version.cue getVersion
|
||||
dagger "do" -p ./credentials.cue verify
|
||||
dagger "do" -p ./config_file.cue verify
|
||||
}
|
||||
Reference in New Issue
Block a user