Colored prompt in asciinema.

Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
Fabian Kammel 2023-02-10 16:56:08 +00:00 committed by Moritz Eckert
parent 5f9cc52f50
commit ad103e6d7a
4 changed files with 27 additions and 27 deletions

View file

@ -14,12 +14,14 @@ ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin"
RUN go install github.com/sigstore/cosign/cmd/cosign@latest
RUN go install github.com/sigstore/rekor/cmd/rekor-cli@latest
# Set prompt
ENV PS1='$ '
ENV SHELL=/bin/bash
ENV TERM=xterm-256color
ENV COLUMNS=200
RUN echo 'export PS1="\[\033[38;2;144;255;153m\]~/constellation\[\033[0m\]\r\n\[\033[38;2;139;4;221m\]$\[\033[0m\] "' >> /root/.bashrc
# Copy install scripts
COPY ./*.sh /root/
WORKDIR /root
ENTRYPOINT ["/usr/bin/expect", "-f"]
CMD ["verify-cli.sh", "/recordings/verify-cli.cast"]
CMD ["verify-cli.sh"]

View file

@ -8,7 +8,7 @@ set record_name [lindex $argv 0];
proc expect_prompt {} {
# make sure this matches your prompt
expect "$ "
expect "0m "
}
proc run_command {cmd} {
@ -24,7 +24,7 @@ proc send_keystroke_to_interactive_process {key {addl_sleep 2}} {
}
# Start recording
spawn asciinema rec --overwrite $record_name
spawn asciinema rec --overwrite /recordings/check-sbom.cast
send "\r"
expect_prompt

View file

@ -2,46 +2,39 @@
# Note: Expects to be able to run 'sudo install' without a password
set timeout -1
set send_human {0.05 0 1 0.05 0.3}
set send_human {0.005 0.015 1 0.05 0.3}
set CTRLC \003
set record_name [lindex $argv 0];
proc expect_prompt {} {
# make sure this matches your prompt
expect "$ "
expect "0m "
}
proc run_command {cmd} {
send -h "$cmd"
send "\r"
expect -timeout 1
}
proc send_keystroke_to_interactive_process {key {addl_sleep 2}} {
send "$key"
expect -timeout 1
sleep $addl_sleep
send -h "$cmd\r"
expect -timeout 3
}
# Start recording
spawn asciinema rec $record_name
spawn asciinema rec --overwrite /recordings/verify-cli.cast
send "\r"
expect_prompt
### Step 0: Requirements
run_command "echo Step 0: Installing requirements"
expect_prompt
run_command "go install github.com/sigstore/cosign/cmd/cosign@latest"
expect_prompt
run_command "go install github.com/sigstore/rekor/cmd/rekor-cli@latest"
expect_prompt
# run_command "echo Step 0: Installing requirements"
# expect_prompt
# run_command "go install github.com/sigstore/cosign/cmd/cosign@latest"
# expect_prompt
# run_command "go install github.com/sigstore/rekor/cmd/rekor-cli@latest"
# expect_prompt
### Step 1: Download CLI
run_command "echo Step 1: Download CLI and signature"
expect_prompt
run_command "curl -sLO https://github.com/edgelesssys/constellation/releases/latest/download/constellation-linux-amd64"
run_command "curl -LO https://github.com/edgelesssys/constellation/releases/latest/download/constellation-linux-amd64"
expect_prompt
run_command "curl -sLO https://github.com/edgelesssys/constellation/releases/latest/download/constellation-linux-amd64.sig"
run_command "curl -LO https://github.com/edgelesssys/constellation/releases/latest/download/constellation-linux-amd64.sig"
expect_prompt
### Step 2: Verify the CLI using cosign

View file

@ -7,5 +7,10 @@ docker run -it -v "$(pwd)"/recordings:/recordings screenrecodings
cp recordings/verify-cli.cast ../static/assets/verify-cli.cast
# Generate cast to check SBOM
docker run -it -v "$(pwd)"/recordings:/recordings screenrecodings check-sbom.sh /recordings/check-sbom.cast
cp recordings/check-sbom.cast ../static/assets/check-sbom.cast
# docker run -it -v "$(pwd)"/recordings:/recordings screenrecodings check-sbom.sh /recordings/check-sbom.cast
# cp recordings/check-sbom.cast ../static/assets/check-sbom.cast
# docker rm -f recorder || true
# docker build -t screenrecodings docker
# docker run --name recorder -d -v "$(pwd)"/recordings:/recordings screenrecodings
# docker exec recorder /bin/bash < . check-sbom.sh /recordings/check-sbom.cast