Skip to content

Kernel Building Scripts - Integrated With CI/CD And Telegram Bot

Notifications You must be signed in to change notification settings

EternalX-project/ci_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CI/CD Kernel Building Scripts

A useful advanced kernel building scripts with CI/CD and Telegram bot integration features.
Can be used on local or remote machine.
Including Anykernel3 flashable repacking.

Installing Dependencies

  • Update package list

    sudo apt-get update
    
  • Install prerequiresites

    sudo apt-get install python \
                         python2 \
                         python3 \
                         python3-pip 
                         tzdata \
                         build-essential \
                         bc \
                         bison \
                         flex \
                         gcc \
                         clang \
                         libc6 \
                         libstdc++6 \
                         libssl-dev \
                         zip \
                         p7zip-full \
                         git                    
    
  • Install python libraries

    pip3 install -r requirements.txt
    

Usage

NOTE: before building, you must edit the ci_build.cfg according your needed. (Instructions inside)

  • Starting building and verbosely building process in your terminal.
    • python3 ci_build.py --build --verbose
  • Add --tele-notifier Argument to Enable Telegram bot integration.
    • Enable building confirmation dialog to telegram bot. (reply with message Y to continue building or N to abort building)
      • python3 ci_build.py --build --tele-notifier --tele-check
    • Synchronize Host Server(CI/CD) with remote timezone.
      • python3 ci_build.py --build --tele-notifier --tele-tz Asia/Jakarta
    • Send file to telegram bot (this is another feature of our scripts. can be used if you remote your CI/CD Server by SSH and need to send a file to telegram bot)
      • python3 ci_build.py --build --tele-notifier --tele-ship ./foo.zip
  • Clean build output.
    • python3 ci_build.py --clean
  • Show command arguments
    • python3 ci_build.py --help

Telegram Bot Integration

NOTE: --tele-notifier Command Script Arguments is needed to enable telegram bot integration

  • Reconfigure ci_build.cfg using telegram bot.

    You can reconfigure building scripts by sending messages example below to telegram bot.
    KLIB=True
    FLASHABLE=True
    DO_DEVICE=rosy
    KERNEL_STRING=EternalX<s>Kernel<s>Stable
    SUPPORTED_VER=8-9
    ZIPNAME=kernel-name
    DEFCONFIG=someone_defconfig
    CPU=6
    COMPILER=clang
    USER=zexceed
    HOST=lawliet
    
    NOTE:
    • that messages must sended before building is started.
    • space not allowed (except KERNEL_STRING use <s> for space).
    • Don't send any messages after that messages before building is started.
    • that messages will be readable for 24 hours. if past 24 hour you need send the message again.
    • if configurations is not in the message. it will be follow default ci_build.cfg.
    • messages is case sensitive.

CI/CD Integration

  • Prepare for source

    Fork this repository to your github and edit ci_build.cfg. and then make sure you have a repository of your kernel source, toolchain, and anykernel3 that will needed by CI/CD.
  • Set up CI/CD Configurations

    Add Building Commands to your CI/CD Configurations (config.yml)
    • Configurations Example for Drone CI:
      --- 
      kind: pipeline
      name: EternalX-Pipeline
      
      clone:
        depth: 1
      
      steps: 
        - name: Building
          commands:
            - apt-get -y update && apt-get -y upgrade && apt-get -y install python python2 python3 python3-pip tzdata build-essential bc bison flex gcc clang libc6 libstdc++6 libssl-dev zip p7zip-full git
            - git clone https://github.com/EternalX-project/ci_script -b master --depth=1
            - cd ci_script
            - git clone https://github.com/EternalX-project/android_kernel_xiaomi_rosy-4.9.git --depth=1
            - git clone https://github.com/EternalX-project/EternalX-flasher --depth=1
            - git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b ndk-release-r16 --depth=1
            - pip3 install -r requirements.txt  
            - python3 ci_build.py --build --tele-notifier --tele-check --verbose --tele-tz Asia/Jakarta
          image: fadlyas/kernel_dockerfile:latest
      
      trigger:
        branch:
          - lineage-18.1
      
    • Configurations Example for Circle CI:
      version: 2.1
      jobs:
        compile:
         docker:
            - image: ubuntu:20.04
         steps:
            - run:
                no_output_timeout: 50m 
                command: |
                 apt-get -y update && apt-get -y upgrade && apt-get -y install python python2 python3 python3-pip tzdata build-essential bc bison flex gcc clang libc6 libstdc++6 libssl-dev zip p7zip-full git
                 git clone https://github.com/zexceed12300/ci_script -b master
                 cd ci_script
                 git clone https://github.com/zexceed12300/EternalX-flasher
                 git clone https://github.com/EternalX-project/android_kernel_xiaomi_rosy-4.9.git
                 git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b ndk-release-r16 --depth=1
                 pip3 install -r requirements.txt   
                 python3 ci_build.py --build --tele-notifier --tele-check --verbose --tele-tz Asia/Jakarta
      workflows:
        version: 2.1
        cooking:
          jobs:
            - compile
      
  • Start building

    You can start building by push some commit to your repository or start directly on CI/CD pipelines.

About

Kernel Building Scripts - Integrated With CI/CD And Telegram Bot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages