Skip to content

Commit

Permalink
OPSEXP-2737 Some minor but necessary workflow improvement (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn authored Jul 30, 2024
1 parent 5cffa63 commit 01d7e8d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
github-actions:
patterns:
- "*"
46 changes: 29 additions & 17 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
name: Build, Run and Test Docker Image

on: [push]
on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }}
cancel-in-progress: true

jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup .netrc
- name: Setup nexus authentication
run: |
echo "machine nexus.alfresco.com" >> ~/.netrc
echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc
- name: Fetch artifacts from nexus
run: ${{ github.workspace }}/scripts/fetch-artifact.sh
working-directory: ${{ github.workspace }}
run: ./scripts/fetch-artifact.sh

- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # 3.1.0
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # v3.4.0

- name: Login to Docker Hub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 3.2.0
- name: Login to Quay.io
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
Expand All @@ -34,18 +44,20 @@ jobs:
- name: Bake Docker images
uses: docker/bake-action@eac74531aa56a9266bfedfe5edb6b851ce2cca2b # v5.4.0

- name: Show all images
- name: Show all built images
run: docker images

- name: Docker save the images produced by the bake action with the name consisting alfresco
- name: Docker save all baked images whose name include `alfresco`
run: |
docker save -o /tmp/alfresco-docker-images.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco)
- name: Upload image as a tar for next job
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
- name: Upload images as artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: ${{ github.run_number }}
name: docker-images
path: /tmp/alfresco-docker-images.tar
retention-days: 1
compression-level: 0

compose-test:
name: compose-test ${{ matrix.docker-compose-file }}
Expand All @@ -56,13 +68,13 @@ jobs:
docker-compose-file: [docker-compose.yml, docker-compose-components.yml]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # v3.4.0

- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: /tmp
name: "${{ github.run_number }}"
name: docker-images

- name: Load Docker images
run: |
Expand Down
3 changes: 2 additions & 1 deletion scripts/fetch-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ for i in $(find . -name artifacts.json -mindepth 2); do
ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/repository/${ARTIFACT_REPO}"
echo "Downloading $ARTIFACT_GROUP:$ARTIFACT_NAME $ARTIFACT_VERSION from $ARTIFACT_BASEURL"
wget "${ARTIFACT_BASEURL}/${ARTIFACT_GROUP//\./\/}/${ARTIFACT_NAME}/${ARTIFACT_VERSION}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}" \
-O ${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}
-O ${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT} \
--no-verbose
done
done

0 comments on commit 01d7e8d

Please sign in to comment.