Skip to content
Snippets Groups Projects
.gitlab-ci.yml 5.03 KiB
image: registry.gitlab.freifunk-stuttgart.de/firmware/ffs-buildenv:master

variables:
  GIT_SUBMODULE_STRATEGY: normal
  DOCKER_DRIVER: overlay2

stages:
  - generate_date
  - update
  - build
  - package

default:
  before_script:
    - git submodule foreach 'git fetch --tags'
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$GIT_SSH_PRIV_KEY")
    - git config --global user.email "firmware@freifunk-stuttgart.de"
    - git config --global user.name "FFS Buildbot"
    - mkdir -p ~/.ssh
    - cat gitlab-known-hosts >> ~/.ssh/known_hosts
    - test -d ffs-openwrt-dl-cache || git clone ssh://git@ssh.gitlab.freifunk-stuttgart.de:22220/firmware/ffs-openwrt-dl-cache.git
    - git -C ffs-openwrt-dl-cache pull --no-rebase || true
    - rm -rf gluon/openwrt/dl && mkdir -p gluon/openwrt && ln -s ../../ffs-openwrt-dl-cache gluon/openwrt/dl
    - rm -rf gluon/openwrt/staging_dir && mkdir -p staging_dir && ln -s ../../staging_dir gluon/openwrt/staging_dir
  after_script:
    # we need to start the SSH agent again because it doesn't seem to stay running
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$GIT_SSH_PRIV_KEY")
    - git config --global user.email "firmware@freifunk-stuttgart.de"
    - git config --global user.name "FFS Buildbot"
    - mkdir -p ~/.ssh
    - cat gitlab-known-hosts >> ~/.ssh/known_hosts
    - cd gluon/openwrt/dl 
    - git pull --no-rebase || true
    - git add . && git commit -m "update DL cache" || true
    - git pull --no-rebase && git push || true

generate_date:
  stage: generate_date
  before_script:
    - echo dummy
  after_script:
    - echo dummy
  script: 
    - date '+%Y-%m-%d' > build.date
  artifacts:
    paths:
      - build.date
    expire_in: 1 day
  except:
    - tags

update:
  stage: update
  script:
    - make -C gluon update GLUON_SITEDIR="$CI_PROJECT_DIR" FFS_BUILD_DATE=$(cat build.date)
  artifacts:
    paths:
      - gluon/
    expire_in: 1 day
  except:
    - tags

.target:
  stage: build
  except:
    - tags