Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 0 additions & 16 deletions .automation/build-rpm.sh

This file was deleted.

26 changes: 0 additions & 26 deletions .automation/build-srpm.sh

This file was deleted.

36 changes: 0 additions & 36 deletions .copr/Makefile

This file was deleted.

123 changes: 86 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,152 @@
---
name: build

on:
push:
branches: [master]
tags: ['*']
pull_request:
branches: [master]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
name: Test and build
container:
image: quay.io/ovirt/buildcontainer:el10stream

steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Run maven build
run: |
./autogen.sh
./configure
mvn test -P\!slow-tests-disabled

build-rpms:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- name: almalinux-9
shortcut: el9
container-name: almalinux9
- name: almalinux-10
shortcut: el10
container-name: almalinux10
- name: centos-stream-9
shortcut: cs9
shortcut: el9s
container-name: el9stream
- name: centos-stream-10
shortcut: cs10
shortcut: el10s
container-name: el10stream

name: ${{ matrix.name }}

env:
ARTIFACTS_DIR: exported-artifacts

name: Build on ${{ matrix.name }}
container:
image: quay.io/ovirt/buildcontainer:${{ matrix.container-name }}

steps:
- name: Checkout sources
uses: actions/checkout@v7

- name: Checkout sources
uses: ovirt/checkout-action@main
- name: Mark repository as safe
run: git config --global --add safe.directory "$(pwd)"

- name: Mark git repo as safe
run: git config --global --add safe.directory $(pwd)
- name: Install dependencies
run: |
dnf install -y \
apache-commons-lang3 \
autoconf \
automake \
gcc \
git \
jackson-annotations \
jackson-core \
jackson-databind \
java-21-openjdk-devel \
javapackages-tools \
junit \
make \
maven \
maven-local-openjdk21 \
maven-source-plugin \
mockito \
rpm-build \
slf4j \
slf4j-jdk14

- name: Set build environment
run: |
TAG=$(git tag --points-at HEAD | head -1)
if [[ -n "$TAG" ]]; then
if [[ "$TAG" =~ -([0-9]+)$ ]]; then
echo "PACKAGE_RPM_RELEASE=${BASH_REMATCH[1]}" >> $GITHUB_ENV
else
echo "PACKAGE_RPM_RELEASE=1" >> $GITHUB_ENV
fi
else
echo "RELEASE_SUFFIX=.$(date --utc +%Y%m%d%H%M%S).git$(git rev-parse --short HEAD)" >> $GITHUB_ENV
fi

- name: Autogen
run: ./autogen.sh

- name: Configure
run: ./configure

- name: Run tests
run: mvn test -P\!slow-tests-disabled

- name: Build RPM
run: make -j rpm

- name: Collect artifacts
run: |
mkdir -p exported-artifacts
find tmp.repos -iname \*rpm -exec mv "{}" exported-artifacts/ \;
mv ./*tar.gz exported-artifacts/

- name: Perform build
run: |
.automation/build-rpm.sh $ARTIFACTS_DIR
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: rpm-${{ matrix.shortcut }}
path: exported-artifacts

- name: Upload artifacts
uses: ovirt/upload-rpms-action@main
with:
directory: ${{ env.ARTIFACTS_DIR }}
publish-rpms:
permissions:
artifact-metadata: read
needs: build
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
uses: ovirt/ovirt-workflows/.github/workflows/publish-rpms.yml@main
secrets: inherit

publish-snapshot:
needs: build-rpms
needs: build
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
name: Publish snapshot to maven central

container:
image: quay.io/ovirt/buildcontainer:el10stream

steps:
- name: Checkout sources
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Mark git repo as safe
run: git config --global --add safe.directory $(pwd)

- name: Use cache for maven
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Set up Maven settings.xml
uses: s4u/maven-settings-action@v3.1.0
with:
path: /root/.m2/settings.xml
servers: |
[{
"id": "central",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_TOKEN }}"
}]

- name: Publish snapshot
run: |
./autogen.sh
./configure --with-maven-version-snapshot
mvn --batch-mode -DskipTests deploy

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
22 changes: 21 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,27 @@

AUTOMAKE_OPTIONS = foreign 1.9
ACLOCAL_AMFLAGS = -I m4
SHELL := /bin/bash

TMPREPOS = tmp.repos
RPMBUILD_ARGS := --define="_topdir `pwd`/$(TMPREPOS)"
RPMBUILD_ARGS += $(if $(RELEASE_SUFFIX), --define="release_suffix $(RELEASE_SUFFIX)")

srpm: dist
rm -fr "$(TMPREPOS)"
mkdir -p $(TMPREPOS)/{SPECS,RPMS,SRPMS,SOURCES}
rpmbuild $(RPMBUILD_ARGS) -ts "$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz"
@echo
@echo "srpm available at '$(TMPREPOS)'"
@echo

rpm: srpm
rpmbuild $(RPMBUILD_ARGS) --rebuild "$(TMPREPOS)"/SRPMS/*.src.rpm
@echo
@echo "rpm(s) available at '$(TMPREPOS)'"
@echo

.PHONY: srpm rpm
MAINTAINERCLEANFILES = \
config.log config.status \
$(srcdir)/Makefile.in \
Expand All @@ -46,7 +66,7 @@ dist_noinst_DATA = \
$(NULL)

clean-local:
rm -fr target
rm -fr target tmp.repos
if !WITH_DIST_ONLY
$(MVN) clean
endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.StandardSocketOptions;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
Expand Down Expand Up @@ -45,6 +46,7 @@ private ServerSocketChannel setupChannel(InetSocketAddress address)
serverSocketChannel.configureBlocking(false);

try {
serverSocketChannel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
serverSocketChannel.register(this.selector, SelectionKey.OP_ACCEPT, this);
log.debug("Binding to {}", address);
serverSocketChannel.bind(address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ public void testNotConnectedRetry() throws InterruptedException, TimeoutExceptio
assertTrue(closeTask.isDone());

futureListener = this.reactorForListener.createListener(HOSTNAME,
//fixme this port is occasionally not free. Most likely it is because of combination of
// 1. its state in TIME_WAIT where it enters after listener.close()
// 2. and delayed TCP packets(fragments) more details at [1]
// [1] https://vincent.bernat.ch/en/blog/2014-tcp-time-wait-state-linux
port,
_client -> _client.addEventListener(_client::sendMessage));

Expand Down
10 changes: 6 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ AC_PREREQ(2.60)

define([VERSION_MAJOR], [1])
define([VERSION_MINOR], [7])
define([VERSION_FIX], [4])
define([VERSION_FIX], [5])
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
define([VERSION_SUFFIX], [])

AC_INIT([vdsm-jsonrpc-java], VERSION_NUMBER[]VERSION_SUFFIX)
AC_INIT([vdsm-jsonrpc-java], VERSION_NUMBER)
PACKAGE_RPM_VERSION="VERSION_NUMBER"
PACKAGE_RPM_RELEASE="1"
AC_ARG_VAR([PACKAGE_RPM_RELEASE],
[RPM release field (default: 0.master for development, release number for release builds)])
AS_IF([test -z "$PACKAGE_RPM_RELEASE"],
[PACKAGE_RPM_RELEASE="0.master"])
PACKAGE_MAVEN_VERSION="VERSION_MAJOR.VERSION_MINOR.VERSION_FIX"
AC_SUBST([PACKAGE_RPM_VERSION])
AC_SUBST([PACKAGE_RPM_RELEASE])
Expand Down
Loading