Quarkus: Request: Example gitlab-ci.yml with jvm and native builds

Created on 13 Jan 2020  路  18Comments  路  Source: quarkusio/quarkus

Can you add an example gitlab-ci.yml file to the documentation? I haven't been able to find such an example and it would be especially interesting to include tasks for tests, native tests, jvm builds and native builds. Including such an example allows an easier start into Quarkus.

good first issue kinquestion

Most helpful comment

Currently, I am using JIB without neither; it works faster than "dind" and does not require an image with Docker CLI.

quarkus:

  container-image:
    group: mycompany/myproject
    registry: ${CI_REGISTRY}
    username: ${CI_REGISTRY_USER}
    password: ${CI_REGISTRY_PASSWORD}

All 18 comments

Are you talking about the Quarkus build or the projects we generate?

@andreas-eberle ping?

Oh, sorry, didn't see your answer.

I was talking about an example for how to build a gitlab-ci.yml for my projects I build with Quarkus. So for a user of Quarkus. It would be especially interesting to know how to make a native build with the docker-build in gitlab.

So we could include that in our project template (and probably something for GH actions too) but we would need someone to handle that and maintain it.

Do you volunteer? :)

Unfortunately, I'm not deep into gitlab. That's why I'm asking for the example.

@andreas-eberle ; hopefully this helps:

install-graal.sh

#!/usr/bin/env bash

echo "Downloading GraalVM"
wget -q https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-19.3.1/graalvm-ce-java8-linux-amd64-19.3.1.tar.gz
tar zxf graalvm-ce-java8-linux-amd64-19.3.1.tar.gz

echo "Installing GraalVM via gu"

${CI_PROJECT_DIR}/graalvm-ce-java8-19.3.1/bin/gu install native-image

.gitlab-ci.yml

image: maven:latest

cache:
  paths:
    - .m2/repository/

before_script:
  - apt-get update -qq
  - apt-get install -y -qq build-essential libz-dev zlib1g-dev

build:
  stage: build
  script:
    - chmod +x install-graal.sh && ./install-graal.sh jdk8
    - export GRAALVM_HOME=${CI_PROJECT_DIR}/graalvm-ce-java8-19.3.1
    - mvn clean install -P native

@gsmet ; happy to raise a PR if you can suggest where it should live.

@garethahealy: I was actually able to use the image: oracle/graalvm-ce:19.3.1-java11, which has graalvm installed and configured.

Unfortunately, I still haven't found an good way to run the native build as dockerbuild inside gitlab. However, this might also have to do with our Gitlab instance making this a bit tricky. So I cannot really judge that.

AFAIK for Docker build you need "dind", and then you can either run CI on Docker image or use whatever you want and use job-specific Docker image just for the build job.

Another option would be to use JIB, but I cannot figure out how to configure credential properly - it always ends up with 403. I came here because I was wondering did anybody ask for CI guide for jib.

馃憢hello - about Docker, you don't need "dind", you can use Kaniko: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html

Currently, I am using JIB without neither; it works faster than "dind" and does not require an image with Docker CLI.

quarkus:

  container-image:
    group: mycompany/myproject
    registry: ${CI_REGISTRY}
    username: ${CI_REGISTRY_USER}
    password: ${CI_REGISTRY_PASSWORD}

@gsmet This is listed as a good first issue, I could give this a shot, maybe add the configuration template to the repo

@sladyn98 sure!

As suggested earlier

image: maven:latest

cache:
  paths:
    - .m2/repository/

before_script:
  - apt-get update -qq
  - apt-get install -y -qq build-essential libz-dev zlib1g-dev

build:
  stage: build
  script:
    - chmod +x install-graal.sh && ./install-graal.sh jdk8
    - export GRAALVM_HOME=${CI_PROJECT_DIR}/graalvm-ce-java8-19.3.1
    - mvn clean install -P native

This could go in the root of the project as
gitlabci.yml

I tried the 2 scripts above, unfortunately it doesn't work for me as I got:

/usr/bin/bash: line 99: apt-get: command not found
ERROR: Job failed: exit code 1

Anybody has an update on how to create a pipeline for Quarkus project in GitLab?

@czetsuya what image did you use? i had: maven:latest

@garethahealy when I tried to commit that in GitLab I got:

$ apt-get update -qq
/usr/bin/bash: line 99: apt-get: command not found

I tried using maven:3.6.3-openjdk-11-slim version and apt-get is recognized but I got:

./install-graal.sh: line 4: wget: command not found

After updating both .gitlab-ci.yaml and install-graal.sh, here's the version that works for me:

https://czetsuya-tech.blogspot.com/2020/08/building-quarkus-in-gitlab.html

Was this page helpful?
0 / 5 - 0 ratings