Update BTFHub Archive #697
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
name: Update BTFHub Archive | |
on: | |
schedule: | |
- cron: "0 1 * * *" | |
workflow_dispatch: {} | |
jobs: | |
build: | |
name: Update BTF Archive | |
env: | |
HOME: "/tmp/root" | |
GOPATH: "/tmp/go" | |
GOCACHE: "/tmp/go-cache" | |
GOROOT: "/usr/local/go" | |
runs-on: | |
[ | |
"github-self-hosted_ami-0f4881c8d69684001_${{ github.event.number }}-${{ github.run_id }}", | |
] | |
steps: | |
# | |
- name: Setup Swap File | |
run: | | |
sudo fallocate -l 16G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
shell: bash | |
# | |
- name: Install needed ubuntu packages | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo dpkg --purge unattended-upgrades | |
sudo apt-get update | |
sudo apt-get install -y bsdutils build-essential pkgconf | |
sudo apt-get install -y zlib1g-dev libelf-dev | |
sudo apt-get install -y software-properties-common | |
sudo apt-get install -y devscripts ubuntu-dev-tools | |
shell: bash | |
# | |
- name: Update alternatives for LLVM | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo update-alternatives --remove-all cc || true | |
sudo update-alternatives --remove-all clang || true | |
sudo update-alternatives --remove-all clang++ || true | |
sudo update-alternatives --remove-all llc || true | |
sudo update-alternatives --remove-all lld || true | |
sudo update-alternatives --remove-all clangd || true | |
sudo update-alternatives --remove-all clang-format || true | |
sudo update-alternatives --remove-all llvm-strip || true | |
sudo update-alternatives --remove-all llvm-config || true | |
sudo update-alternatives --remove-all ld.lld || true | |
sudo update-alternatives --remove-all llvm-ar || true | |
sudo update-alternatives --remove-all llvm-nm || true | |
sudo update-alternatives --remove-all llvm-objcopy || true | |
sudo update-alternatives --remove-all llvm-objdump || true | |
sudo update-alternatives --remove-all llvm-readelf || true | |
sudo update-alternatives --remove-all opt || true | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 140 \ | |
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-14 \ | |
--slave /usr/bin/clangd clangd /usr/bin/clangd-14 \ | |
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-14 \ | |
--slave /usr/bin/lld lld /usr/bin/lld-14 \ | |
--slave /usr/bin/llc llc /usr/bin/llc-14 \ | |
--slave /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-14 \ | |
--slave /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-14 \ | |
--slave /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-14 \ | |
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-14 \ | |
--slave /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-14 \ | |
--slave /usr/bin/llvm-objcopy llvm-objcopy /usr/bin/llvm-objcopy-14 \ | |
--slave /usr/bin/llvm-objdump llvm-objdump /usr/bin/llvm-objdump-14 \ | |
--slave /usr/bin/llvm-readelf llvm-readelf /usr/bin/llvm-readelf-14 \ | |
--slave /usr/bin/opt opt /usr/bin/opt-14 \ | |
--slave /usr/bin/cc cc /usr/bin/clang-14 | |
shell: bash | |
# | |
- name: Authenticate | |
run: | | |
gh auth login --with-token <<<'${{ secrets.PAT_RAFAEL }}' | |
# | |
- name: Check out BTFHub | |
uses: actions/checkout@v3 | |
with: | |
repository: aquasecurity/btfhub | |
path: ./btfhub | |
token: ${{ secrets.PAT_RAFAEL }} | |
# Authenticate | |
- name: Checkout BTFHub Archive | |
uses: actions/checkout@v3 | |
with: | |
repository: aquasecurity/btfhub-archive | |
path: ./btfhub-archive | |
token: ${{ secrets.PAT_RAFAEL }} | |
# | |
- name: Install pahole | |
run: | | |
cd btfhub | |
./3rdparty/pahole.sh | |
shell: bash | |
# | |
- name: Install bpftool | |
run: | | |
cd btfhub | |
./3rdparty/bpftool.sh | |
shell: bash | |
# | |
- name: Bring current BTFHub Archive | |
run: | | |
cd btfhub | |
make bring | |
shell: bash | |
# | |
- name: Compile BTFHub Tool | |
run: | | |
cd btfhub | |
make | |
shell: bash | |
# | |
- name: Fetch and Generate new BTFs (UBUNTU) | |
run: | | |
cd btfhub | |
./btfhub -workers 6 -d ubuntu | |
# debian stretch seems to be gone, updates for buster and bullseye only | |
- name: Fetch and Generate new BTFs (DEBIAN) | |
run: | | |
cd btfhub | |
./btfhub -workers 6 -d debian -r buster | |
./btfhub -workers 6 -d debian -r bullseye | |
# | |
- name: Fetch and Generate new BTFs (CENTOS) | |
run: | | |
cd btfhub | |
./btfhub -workers 6 -d centos | |
# | |
- name: Fetch and Generate new BTFs (FEDORA) | |
run: | | |
cd btfhub | |
./btfhub -workers 6 -d fedora | |
# | |
- name: Fetch and Generate new BTFs (ORACLE) | |
run: | | |
cd btfhub | |
./btfhub -workers 6 -d ol | |
# | |
- name: Take new BTFs to BTFHub Archive | |
run: | | |
cd btfhub | |
make take | |
# | |
- name: Check Status | |
run: | | |
cd btfhub-archive | |
git status | |
# | |
- name: Commit and Push to BTFHub Archive | |
run: | | |
cd btfhub-archive | |
git config --local user.name "Rafael David Tinoco" | |
git config --local user.email "[email protected]" | |
git add -A | |
git diff-index --quiet HEAD || git commit -m "Update BTFHUB Archive from BTFHUB" | |
git push |