Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Jul 12, 2023
1 parent 89a6e37 commit a994b4a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 32 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Build Tests

on: [push, pull_request]

env:
COPR_REPO: ${{ vars.COPR_REPO || '@pki/11.4' }}

jobs:
init:
name: Initialization
Expand All @@ -22,13 +25,11 @@ jobs:
dnf install -y dnf-plugins-core moby-engine maven rpm-build
if [ -n "$COPR_REPO" ]; then dnf copr enable -y $COPR_REPO; fi
dnf builddep -y --skip-unavailable --spec tomcatjss.spec
env:
COPR_REPO: ${{ needs.init.outputs.repo }}
- name: Install JSS packages from jss-dist
run: |
docker pull quay.io/dogtagpki/jss-dist:latest
docker create --name=jss-dist quay.io/dogtagpki/jss-dist:latest
docker pull quay.io/dogtagpki/jss-dist:5.4
docker create --name=jss-dist quay.io/dogtagpki/jss-dist:5.4
docker cp jss-dist:/root/RPMS /tmp/RPMS/
docker rm -f jss-dist
dnf localinstall -y /tmp/RPMS/*
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Build Tomcat JSS

on: [push, pull_request]

env:
COPR_REPO: ${{ vars.COPR_REPO || '@pki/11.4' }}

jobs:
init:
name: Initialization
Expand Down Expand Up @@ -32,7 +35,7 @@ jobs:
context: .
build-args: |
BASE_IMAGE=${{ needs.init.outputs.base-image }}
COPR_REPO=${{ needs.init.outputs.repo }}
COPR_REPO=${{ env.COPR_REPO }}
tags: tomcatjss-deps
target: tomcatjss-deps
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -44,7 +47,7 @@ jobs:
context: .
build-args: |
BASE_IMAGE=${{ needs.init.outputs.base-image }}
COPR_REPO=${{ needs.init.outputs.repo }}
COPR_REPO=${{ env.COPR_REPO }}
tags: tomcatjss-builder-deps
target: tomcatjss-builder-deps
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -56,7 +59,7 @@ jobs:
context: .
build-args: |
BASE_IMAGE=${{ needs.init.outputs.base-image }}
COPR_REPO=${{ needs.init.outputs.repo }}
COPR_REPO=${{ env.COPR_REPO }}
tags: tomcatjss-builder
target: tomcatjss-builder
cache-from: type=local,src=/tmp/.buildx-cache
Expand All @@ -74,7 +77,7 @@ jobs:
context: .
build-args: |
BASE_IMAGE=${{ needs.init.outputs.base-image }}
COPR_REPO=${{ needs.init.outputs.repo }}
COPR_REPO=${{ env.COPR_REPO }}
tags: tomcatjss-dist
target: tomcatjss-dist
cache-from: type=local,src=/tmp/.buildx-cache
Expand All @@ -92,7 +95,7 @@ jobs:
context: .
build-args: |
BASE_IMAGE=${{ needs.init.outputs.base-image }}
COPR_REPO=${{ needs.init.outputs.repo }}
COPR_REPO=${{ env.COPR_REPO }}
tags: tomcatjss-runner
target: tomcatjss-runner
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
secrets:
BASE64_OS:
required: false
BASE64_REPO:
required: false
BASE64_DATABASE:
required: false
outputs:
Expand All @@ -22,7 +20,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
base-image: ${{ steps.init.outputs.base-image }}
repo: ${{ steps.init.outputs.repo }}
db-image: ${{ steps.init.outputs.db-image }}
steps:
- name: Clone repository
Expand All @@ -32,7 +29,6 @@ jobs:
id: init
env:
BASE64_OS: ${{ secrets.BASE64_OS }}
BASE64_REPO: ${{ secrets.BASE64_REPO }}
BASE64_DATABASE: ${{ secrets.BASE64_DATABASE }}
run: |
tests/bin/init-workflow.sh
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish Tomcat JSS
on:
push:
branches:
- master
- v8.4

env:
NAMESPACE: ${{ vars.REGISTRY_NAMESPACE || github.repository_owner }}
Expand Down Expand Up @@ -93,5 +93,5 @@ jobs:
- name: Publish tomcatjss-dist image
run: |
docker load --input tomcatjss-dist.tar
docker tag tomcatjss-dist ${{ vars.REGISTRY }}/$NAMESPACE/tomcatjss-dist:latest
docker push ${{ vars.REGISTRY }}/$NAMESPACE/tomcatjss-dist:latest
docker tag tomcatjss-dist ${{ vars.REGISTRY }}/$NAMESPACE/tomcatjss-dist:8.4
docker push ${{ vars.REGISTRY }}/$NAMESPACE/tomcatjss-dist:8.4
10 changes: 7 additions & 3 deletions .github/workflows/sonarcloud-pull.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Sonarcloud-Pull

on:
workflow_run:
workflows: ["Code Analysis"]
types:
- completed

env:
COPR_REPO: ${{ vars.COPR_REPO || '@pki/11.4' }}

jobs:
retrieve-pr:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
Expand Down Expand Up @@ -85,7 +89,7 @@ jobs:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0

- name: Rebase to master
- name: Rebase PR
run: |
git config user.name "GitHub Workflow Action"
git remote add tomcatjss ${{ github.event.repository.clone_url }}
Expand All @@ -101,7 +105,7 @@ jobs:
context: .
build-args: |
BASE_IMAGE=${{ needs.init.outputs.base-image }}
COPR_REPO=${{ needs.init.outputs.repo }}
COPR_REPO=${{ env.COPR_REPO }}
tags: tomcatjss-runner
target: tomcatjss-runner
outputs: type=docker,dest=sonar-runner.tar
Expand Down Expand Up @@ -136,7 +140,7 @@ jobs:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0

- name: Rebase to master
- name: Rebase PR
run: |
git config user.name "GitHub Workflow Action"
git remote add tomcatjss ${{ github.event.repository.clone_url }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ RUN dnf builddep -y --skip-unavailable --spec tomcatjss.spec
FROM tomcatjss-builder-deps AS tomcatjss-builder

# Import JSS packages
COPY --from=quay.io/dogtagpki/jss-dist:latest /root/RPMS /tmp/RPMS/
COPY --from=quay.io/dogtagpki/jss-dist:5.4 /root/RPMS /tmp/RPMS/

# Install build depencencies
RUN dnf localinstall -y /tmp/RPMS/* \
Expand All @@ -71,7 +71,7 @@ COPY --from=tomcatjss-builder /root/tomcatjss/build/RPMS /root/RPMS/
FROM tomcatjss-deps AS tomcatjss-runner

# Import JSS packages
COPY --from=quay.io/dogtagpki/jss-dist:latest /root/RPMS /tmp/RPMS/
COPY --from=quay.io/dogtagpki/jss-dist:5.4 /root/RPMS /tmp/RPMS/

# Import Tomcat JSS packages
COPY --from=tomcatjss-dist /root/RPMS /tmp/RPMS/
Expand Down
11 changes: 0 additions & 11 deletions tests/bin/init-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ BASE_IMAGE=registry.fedoraproject.org/fedora:$OS_VERSION
echo "BASE_IMAGE: $BASE_IMAGE"
echo "base-image=$BASE_IMAGE" >> $GITHUB_OUTPUT

################################################################################
# COPR repository

if [ "$BASE64_REPO" != "" ]
then
REPO=$(echo "$BASE64_REPO" | base64 -d)
fi

echo "REPO: $REPO"
echo "repo=$REPO" >> $GITHUB_OUTPUT

################################################################################
# Database image

Expand Down

0 comments on commit a994b4a

Please sign in to comment.