Skip to content

Commit 370cb0e

Browse files
authored
pktvisor ci release improvements (#564)
pktvisor ci release improvements (#564)
1 parent dd46efa commit 370cb0e

File tree

12 files changed

+318
-56
lines changed

12 files changed

+318
-56
lines changed

.github/actions/build-cpp/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ function build() {
2020
cp -rf /github/workspace/conanfile.txt /pktvisor-src/
2121
mkdir /tmp/build
2222
cd /tmp/build
23-
conan profile new --detect default && \
24-
conan profile update settings.compiler.libcxx=libstdc++11 default && \
23+
conan profile new --detect default
24+
conan profile update settings.compiler.libcxx=libstdc++11 default
2525
conan config set general.revisions_enabled=1
26-
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE -DASAN=$INPUT_ASAN /pktvisor-src && \
26+
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE -DASAN=$INPUT_ASAN /pktvisor-src
2727
make all -j 4
2828
}
2929

.github/hosted-runner/amd64/user_data.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apt-get update -y
55
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
66
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python xvfb \
77
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf g++-10-multilib-arm-linux-gnueabihf \
8-
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd cmake -y
8+
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd cmake zip -y
99

1010
#set permission to use docker
1111
usermod -aG docker ubuntu
@@ -21,6 +21,6 @@ chown ubuntu.ubuntu /actions-runner -R
2121
#extract git actions runner installer
2222
/bin/su -c "cd /actions-runner && tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log
2323

24-
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
24+
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
2525

2626
/bin/su -c "cd /actions-runner && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
resource "aws_instance" "orb-devops" {
2+
ami = lookup(var.amis, var.aws_region)
3+
instance_type = var.instance_type
4+
security_groups = [aws_security_group.sg_SelfRunner_arm32.id]
5+
key_name = var.key_name
6+
user_data = file("user_data.sh")
7+
associate_public_ip_address = true
8+
subnet_id = "subnet-0e4137bca8a8a81da"
9+
10+
ebs_block_device {
11+
device_name = "/dev/sda1"
12+
volume_size = 20
13+
}
14+
15+
tags = {
16+
Name = "orb-pktvisor-self-runner-${var.environment}"
17+
Provider = "terraform"
18+
Role = "test"
19+
}
20+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "ip" {
2+
value = aws_instance.orb-devops.public_ip
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
provider "aws" {
2+
access_key = var.aws_access_key
3+
secret_key = var.aws_secret_key
4+
region = var.aws_region
5+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
resource "aws_security_group" "sg_SelfRunner_arm32" {
2+
name = "sg_pktvisor_SelfRunner_arm32_${var.environment}"
3+
description = "Allow all outbound traffic and inbound 22/80"
4+
vpc_id = "vpc-0cd4a525c008d8d71"
5+
6+
ingress {
7+
from_port = 22
8+
to_port = 22
9+
protocol = "tcp"
10+
cidr_blocks = ["0.0.0.0/0"]
11+
}
12+
13+
ingress {
14+
from_port = 80
15+
to_port = 80
16+
protocol = "tcp"
17+
cidr_blocks = ["0.0.0.0/0"]
18+
}
19+
20+
egress {
21+
from_port = 0
22+
to_port = 0
23+
protocol = "-1"
24+
cidr_blocks = ["0.0.0.0/0"]
25+
}
26+
27+
tags = {
28+
Name = "SelfRunner_arm32_${var.environment}"
29+
Provisioner = "terraform"
30+
31+
}
32+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
#installing packages
4+
apt-get update -y
5+
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
6+
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python xvfb \
7+
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf g++-10-multilib-arm-linux-gnueabihf \
8+
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd cmake zip -y
9+
10+
#set permission to use docker
11+
usermod -aG docker ubuntu
12+
13+
#creating directory git actions runner
14+
mkdir actions-runner && cd actions-runner
15+
16+
chown ubuntu.ubuntu /actions-runner -R
17+
18+
#get git actions self-runner
19+
/bin/su -c "cd /actions-runner && curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log
20+
21+
#extract git actions runner installer
22+
/bin/su -c "cd /actions-runner && tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log
23+
24+
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
25+
26+
/bin/su -c "cd /actions-runner && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
variable "aws_access_key" {
2+
default = "AWSID"
3+
}
4+
variable "aws_secret_key" {
5+
default = "AWSSECRET"
6+
}
7+
8+
variable "environment" {
9+
default = "ENVIRONMENT"
10+
}
11+
12+
variable "aws_region" {
13+
default = "us-east-1"
14+
}
15+
16+
variable "amis" {
17+
type = map
18+
default = {
19+
us-east-1 = "ami-070650c005cce4203" //ubuntu 20.04 arm64 on us-east-1
20+
}
21+
}
22+
23+
variable "key_name" {
24+
default = "devops-key"
25+
}
26+
27+
variable "instance_type" {
28+
default = "t3.xlarge"
29+
}

.github/hosted-runner/arm64/user_data.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apt-get update -y
55
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
66
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python2 xvfb \
77
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf cmake \
8-
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base python3-venv tcpreplay docker.io containerd -y
8+
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base python3-venv tcpreplay docker.io containerd zip -y
99

1010
#set permission to use docker
1111
usermod -aG docker ubuntu
@@ -21,6 +21,6 @@ chown ubuntu.ubuntu /actions-runner -R
2121
#extract git actions runner installer
2222
/bin/su -c "cd /actions-runner && tar xzf ./actions-runner-linux-arm64-2.294.0.tar.gz" - ubuntu >> /home/ubuntu/user-data.log
2323

24-
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name ARM64_RUNNER --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
24+
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name ARM64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
2525

2626
/bin/su -c "cd /actions-runner && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log

0 commit comments

Comments
 (0)