Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/buildenv/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM elek/ozone-build:20191106-1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to move this to Apache ozone ? at some point of time. Not for this patch. Let us get this working; and then move this to Apache Ozone Account in Docker Hub.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I already opened the required PR: apache/ozone-docker#9 It will be available as apache/ozone-build

USER root
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
USER jenkins1001
ENTRYPOINT ["/entrypoint.sh"]
24 changes: 24 additions & 0 deletions .github/buildenv/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/sh -l
if [ "$WITH_DOCKERD" ]; then
sudo dockerd &
sleep 5
chmod 777 /var/run/docker.sock

fi
echo "Execution command inside docker with user $(whoami)"
#fix permission which is not defined by github actions
"$@"
107 changes: 107 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build
on: push
jobs:
build:
name: compile
runs-on: ubuntu-18.04

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were using Alpine for most base. But this is good too. Just commenting since I remember you telling me the reason for this change, but I forgot what it was. Something to do with Java or something ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recently we switched to use centos. Centos is used in the runtime images (apache/ozone and apache/ozone-runner) and it seems to be reasonable to run the unit test in the same environment.

We used alpine earlier but we found very strange seg faults from the rocksdb JNI -> libmusl which has been disappeared with using centos.

This specific line is about the VM. Github actions / azure starts a new VM for each step and we run our build inside a docker container (centos) started by the host (ubuntu).

Except for acceptance testing which requires docker (and nothing more) where it was easier to run the docker-compose based tests from the VM itself.

steps:
- uses: actions/checkout@master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that patch will get rebased automatically the master? if so, awesome.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, It doesn't. But this is the place where we can implement an automatic rebase. The original branch is available from the event file, so we can easily implement it.

- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/build.sh
rat:
name: rat
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/rat.sh
- uses: actions/upload-artifact@master
if: always()
with:
name: rat
path: target/rat
author:
name: author
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/author.sh
- uses: actions/upload-artifact@master
if: always()
with:
name: author
path: target/author
unit:
name: unit
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we run this if and only if the build is successful ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, but this is fast enough, I think we can run it always. But we can define some ordering between build and acceptance/integration which is not yet implemented here.

- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/unit.sh
- uses: actions/upload-artifact@master
if: always()
with:
name: unit
path: target/unit
checkstyle:
name: checkstyle
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/checkstyle.sh
- uses: actions/upload-artifact@master
if: always()
with:
name: checkstyle
path: target/checkstyle
findbugs:
name: findbugs
runs-on: ubuntu-18.04

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, should we serialize this behind the build ? that way if there is a compilation error we will see it and bail.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added dependencies between acceptance and others. I am not sure if we need other one here as findbugs is very fast it's not a big difference (in terms of resource usage) if findbugs are executed later.

But I am open to do it.

I would start the experiment and measure the resource usage and adjust the dependencies based on the data.

steps:
- uses: actions/checkout@master
- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/findbugs.sh
- uses: actions/upload-artifact@master
if: always()
with:
name: findbugs
path: target/findbugs
acceptance:
name: acceptance

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this depend on unit.sh ? and enforce Unit.sh with vengeance ? All of us will be uncomfortable for a while, but then we will realize that unittests being green is the natural state. what do you think ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a dependency between acceptance and the fast jobs (unit/findbugs/checkstyle/builds)

runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/build.sh
- run: sudo pip install robotframework
- run: sudo chown runner -R .
- run: cd ./hadoop-ozone/dist/target/ozone-*-SNAPSHOT/ && mkdir .aws && sudo chown 1000 .aws
- run: ./hadoop-ozone/dev-support/checks/acceptance.sh
- uses: actions/upload-artifact@master
if: always()
with:
name: acceptance
path: target/acceptance
6 changes: 3 additions & 3 deletions hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ Test Bucket Acls
Test key handling
[arguments] ${protocol} ${server} ${volume}
Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key1 /opt/hadoop/NOTICE.txt
Execute rm -f NOTICE.txt.1
Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 NOTICE.txt.1
Execute ls -l NOTICE.txt.1
Execute rm -f /tmp/NOTICE.txt.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't understand what is happening here. Did we remap /opt to /tmp somehow? and the file name is also remapped ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make the acceptance test execute simple I start the acceptance tests directly from the VM (uid=1001) and not from docker container (uid=1000). But the build has been done with uid=1000. To make it possible to run I use /tmp for writing/reading temporary files which is always writable.

Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1
Execute ls -l /tmp/NOTICE.txt.1
${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.name=="key1")'
Should contain ${result} creationTime
${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.name=="key1") | .name'
Expand Down
14 changes: 7 additions & 7 deletions hadoop-ozone/dist/src/main/smoketest/ozonefs/ozonefs.robot
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ Run ozoneFS tests
${result} = Execute ozone sh key list o3://om/fstest/bucket1 | grep -v WARN | jq -r '.name'
Should not contain ${result} testdir

Execute rm -Rf localdir1
Execute mkdir localdir1
Execute cp NOTICE.txt localdir1/LOCAL.txt
Execute rm -Rf /tmp/localdir1
Execute mkdir /tmp/localdir1
Execute cp NOTICE.txt /tmp/localdir1/LOCAL.txt
Execute ozone fs -mkdir -p o3fs://bucket1.fstest/testdir1
Execute ozone fs -copyFromLocal localdir1 o3fs://bucket1.fstest/testdir1/
Execute ozone fs -copyFromLocal /tmp/localdir1 o3fs://bucket1.fstest/testdir1/
Execute ozone fs -put NOTICE.txt o3fs://bucket1.fstest/testdir1/NOTICE.txt

${result} = Execute ozone fs -ls -R o3fs://bucket1.fstest/testdir1/
Expand All @@ -104,9 +104,9 @@ Run ozoneFS tests
${rc} ${result} = Run And Return Rc And Output ozone fs -copyFromLocal NOTICE.txt o3fs://bucket1.fstest/KEY.txt
Should Be Equal As Integers ${rc} 1
Should contain ${result} File exists
Execute rm -Rf GET.txt
Execute ozone fs -get o3fs://bucket1.fstest/KEY.txt GET.txt
Execute ls -l GET.txt
Execute rm -Rf /tmp/GET.txt
Execute ozone fs -get o3fs://bucket1.fstest/KEY.txt /tmp/GET.txt
Execute ls -l /tmp/GET.txt
${rc} ${result} = Run And Return Rc And Output ozone fs -ls o3fs://abcde.pqrs/
Should Be Equal As Integers ${rc} 1
Should Match Regexp ${result} (Check access operation failed)|(Volume pqrs is not found)