mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

vharseko
17.40.2022 c4d282a77ef7701d79db2226136bfbd8e147d95d
.github/workflows/build.yml
@@ -1,4 +1,4 @@
name: Build Maven
name: Build
on:
  push:
@@ -7,8 +7,7 @@
    branches: [ master ]
jobs:
  build:
    name: Maven build
  build-maven:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
@@ -62,7 +61,6 @@
            opendj-dsml-servlet/target/*.war
            opendj-rest2ldap-servlet/target/*.war
  build-docker:
    name: Docker build
    runs-on: 'ubuntu-latest'
    services:
      registry:
@@ -79,7 +77,7 @@
        run:   |
          git fetch -t; export git_version_last="$(git describe --abbrev=0 --tags)" ; echo "last release: $git_version_last"
          echo "release_version=$git_version_last" >> $GITHUB_ENV
      - name: Docker meta (default)
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
        with:
@@ -88,15 +86,6 @@
          tags: |
            type=raw,value=latest
            type=raw,value=${{ env.release_version }}
      - name: Docker meta (alpine)
        id: meta_alpine
        uses: docker/metadata-action@v3
        with:
          images: |
            localhost:5000/${{ github.repository }}
          tags: |
            type=raw,value=alpine
            type=raw,value=${{ env.release_version }}-alpine
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Buildx
@@ -118,12 +107,41 @@
      - name: Docker test
        shell: bash
        run: |
          export docker_image="localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}"
          echo "last release: ${{ env.release_version }}, docker image: ${docker_image}"
          docker run --rm -it -d --name=opendj_1 --health-cmd='/opt/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "" --searchScope base "(objectClass=*)" 1.1 || /opt/opendj/bin/stop-ds || exit 1'  --health-retries=10 --health-timeout=10s ${docker_image}
          timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" opendj_1 | grep -q \"healthy\"; do sleep 10; done'
          docker stop opendj_1 || true
      - name: Build image (alpine)
          docker run --rm -it -d --name=test localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}
          timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" test | grep -q \"healthy\"; do sleep 10; done'
  build-docker-alpine:
    runs-on: 'ubuntu-latest'
    services:
      registry:
        image: registry:2
        ports:
          - 5000:5000
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          submodules: recursive
      - name: Get latest release version
        shell: bash
        run:   |
          git fetch -t; export git_version_last="$(git describe --abbrev=0 --tags)" ; echo "last release: $git_version_last"
          echo "release_version=$git_version_last" >> $GITHUB_ENV
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: |
            localhost:5000/${{ github.repository }}
          tags: |
            type=raw,value=alpine
            type=raw,value=${{ env.release_version }}-alpine
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        with:
          driver-opts: network=host
      - name: Build image
        continue-on-error: true
        uses: docker/build-push-action@v2
        with:
@@ -133,13 +151,10 @@
            VERSION=${{ env.release_version }}
          platforms: linux/amd64,linux/arm64/8, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
          push: true
          tags: ${{ steps.meta_alpine.outputs.tags }}
          labels: ${{ steps.meta_alpine.outputs.labels }}
      - name: Docker alpine test
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
      - name: Docker test
        shell: bash
        run: |
          export docker_image="localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}-alpine"
          echo "last release: ${{ env.release_version }}, docker image: ${docker_image}"
          docker run --rm -it -d --name=opendj_alpine --health-cmd='/opt/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "" --searchScope base "(objectClass=*)" 1.1 || /opt/opendj/bin/stop-ds || exit 1'  --health-retries=10 --health-timeout=10s ${docker_image}
          timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" opendj_alpine | grep -q \"healthy\"; do sleep 10; done'
          docker stop opendj_alpine || true
          docker run --rm -it -d --name=test localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}-alpine
          timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" test | grep -q \"healthy\"; do sleep 10; done'