This repository has been archived by the owner on Dec 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from nre-learning/standardize-image-build
Modified images to support a standard build process
- Loading branch information
Showing
19 changed files
with
223 additions
and
455 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
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,9 @@ | ||
# SHELL=/bin/bash | ||
|
||
TARGET_VERSION ?= latest | ||
|
||
all: docker | ||
|
||
docker: | ||
docker build -t antidotelabs/asterisk:$(TARGET_VERSION) . | ||
docker push antidotelabs/asterisk:$(TARGET_VERSION) |
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 |
---|---|---|
@@ -1,19 +1,27 @@ | ||
# Copyright (c) 2018, Juniper Networks, Inc. | ||
# All rights reserved. | ||
# SHELL=/bin/bash | ||
|
||
all: build | ||
TARGET_VERSION ?= latest | ||
|
||
build: src/cosim.tgz | ||
./build.sh | ||
all: docker | ||
|
||
src/cosim.tgz: | ||
cd vagrant && ./extract_pfe_files.sh ../src | ||
docker: | ||
|
||
run: | ||
docker run -ti --rm --name vqfx --privileged antidote/vqfx:18.4R1.8 | ||
./download_packages.sh | ||
|
||
run1: | ||
docker run -ti --rm --name vqfx --privileged antidote/vqfx:18.1R1.9 | ||
TARGET_VERSION=$(TARGET_VERSION) ./build.sh | ||
|
||
stop: | ||
docker kill vqfx || true | ||
# The below might be useful for building an image with snapshots. | ||
# Currently leaving this commented out so that we can finish the rest of the pipeline without this added | ||
# complexity, not to mention that some infrastructure improvements (both prod and selfmedicate) might mean | ||
# we don't need to do the snapshot trick. However, if it proves necessary in the future, this does work, | ||
# we just need to add the logic to copy the resulting disk file out and into its own container, so we don't | ||
# create a monster image. | ||
# | ||
# docker kill vqfx-full || true | ||
# docker rm vqfx-full || true | ||
# sleep 5 | ||
# docker run -d --name vqfx-full -v $$(pwd):/cap --rm -p 2222:22 -p 4001:4000 -p 5001:5000 --privileged antidotelabs/vqfx-full:$(TARGET_VERSION) | ||
# ./wait_for_live.sh | ||
# docker exec vqfx-full /create_snapshot.expect | ||
|
||
docker push antidotelabs/container-vqfx:$(TARGET_VERSION) |
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
#!/bin/bash | ||
|
||
target=antidotelabs/vqfx-full | ||
target=antidotelabs/container-vqfx | ||
ocpkg=$(ls junos-openconfig-*.tgz) | ||
|
||
docker build -f src/Dockerfile -t container-vqfx src | ||
|
||
for image in *.img; do | ||
version=$(echo "${image%.*}" | cut -d- -f5) | ||
|
||
# Originally, we got the tag from the Junos version. However, we are removing this now | ||
# in favor of the Antidote-relevant tag. | ||
# | ||
# version=$(echo "${image%.*}" | cut -d- -f5) | ||
version=$TARGET_VERSION | ||
|
||
echo "Building container $target:$version ... " | ||
docker build -f Dockerfile.junos --build-arg image=$image --build-arg ocpkg=$ocpkg -t $target:$version . | ||
done |
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,21 @@ | ||
#!/bin/bash | ||
|
||
# This script uses the gsutil utility from Google Cloud | ||
# to download files from the relevant bucket. See | ||
# https://cloud.google.com/sdk/docs/ for instructions on installing | ||
# the Google Cloud SDK, which includes this utility. | ||
|
||
declare -a arr=( | ||
"container-vqfx/junos-openconfig-0.0.0.10-1-signed.tgz" | ||
"container-vqfx/cosim.tgz" | ||
"container-vqfx/jinstall-vqfx-10-f-18.1R1.9.img" | ||
) | ||
|
||
for i in "${arr[@]}" | ||
do | ||
gsutil cp "gs://nrelabs-curriculum-base-images/$i" "./$i" | ||
mv "$i" ./ | ||
done | ||
|
||
rm -rf container-vqfx/ | ||
mv cosim.tgz src/ |
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
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,67 @@ | ||
#!/usr/bin/expect -f | ||
# | ||
# This Expect script was generated by autoexpect on Mon Jul 22 07:12:58 2019 | ||
# Expect and autoexpect were both written by Don Libes, NIST. | ||
# | ||
# Note that autoexpect does not guarantee a working script. It | ||
# necessarily has to guess about certain things. Two reasons a script | ||
# might fail are: | ||
# | ||
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet, | ||
# etc.) and devices discard or ignore keystrokes that arrive "too | ||
# quickly" after prompts. If you find your new script hanging up at | ||
# one spot, try adding a short sleep just before the previous send. | ||
# Setting "force_conservative" to 1 (see below) makes Expect do this | ||
# automatically - pausing briefly before sending each character. This | ||
# pacifies every program I know of. The -c flag makes the script do | ||
# this in the first place. The -C flag allows you to define a | ||
# character to toggle this mode off and on. | ||
|
||
set force_conservative 0 ;# set to 1 to force conservative mode even if | ||
;# script wasn't run conservatively originally | ||
if {$force_conservative} { | ||
set send_slow {1 .1} | ||
proc send {ignore arg} { | ||
sleep .1 | ||
exp_send -s -- $arg | ||
} | ||
} | ||
|
||
# | ||
# 2) differing output - Some programs produce different output each time | ||
# they run. The "date" command is an obvious example. Another is | ||
# ftp, if it produces throughput statistics at the end of a file | ||
# transfer. If this causes a problem, delete these patterns or replace | ||
# them with wildcards. An alternative is to use the -p flag (for | ||
# "prompt") which makes Expect only look for the last line of output | ||
# (i.e., the prompt). The -P flag allows you to define a character to | ||
# toggle this mode off and on. | ||
# | ||
# Read the man page for more info. | ||
# | ||
# -Don | ||
|
||
|
||
set timeout -1 | ||
spawn telnet 127.0.0.1 4000 | ||
match_max 100000 | ||
expect -exact "Trying 127.0.0.1...\r | ||
Connected to 127.0.0.1.\r | ||
Escape character is '^\]'.\r | ||
QEMU 2.11.1 monitor - type 'help' for more information\r | ||
(qemu) " | ||
send -- "stop\r" | ||
expect -exact "stop\r | ||
s\[K\[Dst\[K\[D\[Dsto\[K\[D\[D\[Dstop\[K\r | ||
(qemu) \r | ||
(qemu) " | ||
send -- "savevm speedy\r" | ||
expect -exact "savevm speedy\r | ||
s\[K\[Dsa\[K\[D\[Dsav\[K\[D\[D\[Dsave\[K\[D\[D\[D\[Dsavev\[K\[D\[D\[D\[D\[Dsavevm\[K\[D\[D\[D\[D\[D\[Dsavevm \[K\[D\[D\[D\[D\[D\[D\[Dsavevm s\[K\[D\[D\[D\[D\[D\[D\[D\[Dsavevm sp\[K\[D\[D\[D\[D\[D\[D\[D\[D\[Dsavevm spe\[K\[D\[D\[D\[D\[D\[D\[D\[D\[D\[Dsavevm spee\[K\[D\[D\[D\[D\[D\[D\[D\[D\[D\[D\[Dsavevm speed\[K\[D\[D\[D\[D\[D\[D\[D\[D\[D\[D\[D\[Dsavevm speedy\[K\r | ||
(qemu) \r | ||
(qemu) " | ||
send -- "" | ||
expect -exact "^\]\r | ||
telnet> " | ||
send -- "quit\r" | ||
expect eof |
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,21 @@ | ||
#!/bin/bash | ||
|
||
|
||
until sshpass -p antidotepassword ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -q antidote@localhost -p 2222 exit | ||
do | ||
echo "return is $?, waiting for 0" | ||
sleep 5 | ||
done | ||
|
||
echo "Device is Live" | ||
|
||
while [[ $xeifs -eq 24 ]] | ||
do | ||
# Wait until PFE is active | ||
xeifs=$((sshpass -p antidotepassword ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -q antidote@localhost -p 2222 show interfaces terse | grep xe-0 | wc -l)) | ||
|
||
echo "xeifs is $xeifs, waiting for 24" | ||
sleep 1 | ||
done | ||
|
||
echo "cosim is live" |
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,9 @@ | ||
# SHELL=/bin/bash | ||
|
||
TARGET_VERSION ?= latest | ||
|
||
all: docker | ||
|
||
docker: | ||
docker build -t antidotelabs/netbox:$(TARGET_VERSION) . | ||
docker push antidotelabs/netbox:$(TARGET_VERSION) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.