Skip to content

Instantly share code, notes, and snippets.

@egeneralov
Created June 10, 2020 19:46
Show Gist options
  • Select an option

  • Save egeneralov/aefd04410850ce12a4045b81bce67698 to your computer and use it in GitHub Desktop.

Select an option

Save egeneralov/aefd04410850ce12a4045b81bce67698 to your computer and use it in GitHub Desktop.
gitlab ci build kernel image automatically
variables:
PAT: ""
stages:
- check
- build
kernel:
stage: build
image: debian:10
tags:
- dind
- heavy
script:
- apt-get update -q
- apt-get install -yq wget xz-utils build-essential libncurses-dev bison flex libssl-dev libelf-dev rsync ncdu git python3-pip ffmpeg screen bc kmod cpio
- wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${CI_COMMIT_REF_NAME}.tar.xz
- tar xJvf linux-${CI_COMMIT_REF_NAME}.tar.xz
- cp .config linux-${CI_COMMIT_REF_NAME}
- cd linux-${CI_COMMIT_REF_NAME}
- ls -lha
- make -j $(nproc) bindeb-pkg
- ls -lha
- cd ../
- rm -f linux-image-*dbg*_amd64.deb
- ls -lha
artifacts:
paths:
- linux*.deb
expire_in: 4 weeks
only:
- tags
# - "/^\d+\.\d+\.?\d?+$/"
check:
stage: check
image: alpine
tags:
- dind
- heavy
script:
- apk add --no-cache curl jq
- VERSION=$(curl -s https://www.kernel.org/releases.json | jq '.latest_stable.version' -r)
- 'curl -s --request POST --header "PRIVATE-TOKEN: ${PAT}" "${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${VERSION}&ref=master" | jq'
except:
- tags
only:
- schedules
retry:
max: 2
when:
- script_failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment