[haiku-development] Re: GSoC 2021 mentee

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: "19UCS083 Hrithik Kumar" <hrithik.hrkumar@xxxxxxxxx>, haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 17 Aug 2021 11:11:58 +0000

Hello,

What is the plan here? Can we use this bot to replace madmax' one already, does 
it provide the same services?
Or does it need to be a separate bot account (just for now, or also in the 
future?)

-- 
Adrien.

17 août 2021 12:53 "19UCS083 Hrithik Kumar" <hrithik.hrkumar@xxxxxxxxx> a écrit:

Hey everyone!
Need help, Since we are reaching the end of the GSoC period and it's time for 
submitting final
projects and writing a final blog but before that I need a few things to be 
taken care of.

1. I need a Checker Bot gerrit account so that I can update my pipeline with 
its information. So
can anyone with proper access help me with this?

2. As per the suggestion of @kallisti05@xxxxxxxxx I created a PR for adding 
my gerrit-resource to
the haiku infrastructure repo inside containers folder (gerrit-resource is 
that repo which helps in
triggering the pipeline everytime a changeset/patchset is created). If the 
community thinks this
belongs to a different location then let me know I would create a PR for that.

3. Once the above 2 are taken care of then I would do the final changes in my 
pipeline draft PR,
turn it into an actual PR and after it's merged we can see the bot in action 
:)

Hrithik (ritz)

On Wed, Jul 28, 2021 at 10:28 PM Hrithik Kumar <hrithik.hrkumar@xxxxxxxxx> 
wrote:

Hey everybody!

As you might already know, I have posted Project Update 3 so basically I 
have completed the bot
locally with basic functionalities and now I'm working on integrating my 
work on haiku
infrastructure.

1. As we were discussing about doing the changes in "general-worker" hence I 
cloned the
infrastructure repo and went ahead and made necessary changes locally in its 
Dockerfile to include
jq, clang-format and git-clang-format and pushed it to my personal docker 
hub account. You can find
it here. I then tested it and it is working fine. Below are the changes I 
made.

FROM fedora:latest

USER root

RUN dnf install -y \

attr \

autoconf \

automake \

bc \

bison \

byacc \

bzip2 \

cmake \

curl \

curl-devel \

diffutils \

flex \

gcc \

gcc-c++ \

git \

glibc-devel \

glibc-devel.i686 \

+ jq \

libstdc++ \

libstdc++-static \

libstdc++-devel.x86_64 \

libstdc++-devel.i686 \

libtool \

libfdt \

make \

minisign \

mtools \

nasm \

ninja-build \

python3 \

python3-devel \

swig \

texinfo \

vim \

uboot-tools \

unzip \

wget \

zip \

xorriso \

xz \

zlib \

zlib-devel

ADD https://dl.min.io/client/mc/release/linux-amd64/mc /usr/local/bin/mc

RUN chmod 755 /usr/local/bin/mc

+

+RUN ln -s /usr/bin/python3 /usr/bin/python

+

+RUN git clone --depth 1 https://github.com/viveris/llvm-project.git &&\

+ cd llvm-project &&\

+ mkdir build &&\

+ cd build &&\

+ cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS=clang -G "Unix 
Makefiles" ../llvm &&\

+ make -j 2 clang-format &&\

+ cp ./bin/clang-format /usr/bin &&\

+ cp ../clang/tools/clang-format/git-clang-format /usr/bin &&\

+ cd ../../ &&\

+ rm -rf llvm-project/

and below is the corresponding pipeline.yaml file.

resource_types:

- name: gerrit

type: registry-image
source:
repository: docker.io/bluedocks/gerrit-resource
resources:
- name: test
type: gerrit
source:
url: "http://hrithik:8090";
query: "status:open project:test"
jobs:
- name: job
public: true
plan:
- get: test
trigger: true
- task: list_repo
config:
inputs:
- name: test
platform: linux
image_resource:
type: registry-image
source:
repository: docker.io/bluedocks/general-worker
run:
path: /bin/sh
args:
- -c
- |
cd ./test
git config color.diff false
git clang-format --diff --style=haiku -q HEAD~1 > diff.txt
cat diff.txt
# check if diff.txt is empty or not and set verified
if [ -s diff.txt ]
then
verified=-1
else
verified=1
fi
echo "verified: $verified"
BASE_URL=http://hrithik:8090
CHANGE_ID=$(jq -r '.change_id' ./.gerrit_version.json)
REVISION_ID=$(jq -r '.revision' ./.gerrit_version.json)
TOKEN=Y2hlY2tlcmJvdDpnUlBONXdQQ0tVOTIxTUNzNitBc1dXclNSYzd4Mm9wWlNXNzNtYTRUOFE=
jq --null-input -M --rawfile message diff.txt --arg verified $verified \
'{
"tag": "test tag",
"message": "```\n\($message)\n```",
"labels": {
"Verified": $verified
}
}' > data.json
curl --location --request POST 
"${BASE_URL}/a/changes/${CHANGE_ID}/revisions/${REVISION_ID}/review"
\
--header "Authorization: Basic ${TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary '@data.json'

So should I create a PR for changes in Dockerfile in the infrastructure 
repo? @kallisti05@xxxxxxxxx

2. I have already created a gerrit resource before, for triggering the 
pipeline every time a commit
happens
So where should repo for this resource be added?
Hrithik (ritz)
On Sat, Jul 10, 2021 at 6:39 PM Hrithik Kumar <hrithik.hrkumar@xxxxxxxxx> 
wrote:

On Sat, Jul 10, 2021 at 1:47 AM Alexander von Gluck IV 
<kallisti5@xxxxxxxxxxx> wrote:

The best place for these would be in "haiku/general-worker"

All of the toolchain containers are based on this one:

https://github.com/haiku/infrastructure/tree/master/containers/general-worker

This eventually needs to be decided by the devs before I start working on 
implementing the entire
thing for haiku itself (rather than my local gerrit) that's why the 
question.

Sounds fine to me so far :-) Keep in mind the containers involved in 
builds have no visibility
of builds outside of their pipelines.

Should I create a PR for adding clang-format to Dockerfile of 
general-worker? or will this be
handled by someone else?

This all works for the basic clang-format use case... but if you're 
planning on
trying to "pull code from gerrit, and running a pipeline on that code" 
within
concourse, a resource container should be your target.

If you are talking about having a resource to pull code from gerrit I have 
successfully created a
working resource already, which triggers the pipeline everytime a patchset 
is created (You can find
more about it in GSoC Project Update 2). This resource is hosted in my 
personal dockerhub account
for now and eventually it needs to be tested and maybe we can create a 
new/fork repo under haiku
github account for its source code.

Hrithik (ritz)


Other related posts: