Skip to content

Commit

Permalink
Merge pull request #13 from tisutisu/script-image
Browse files Browse the repository at this point in the history
Infra deployment task script image
  • Loading branch information
tisutisu authored Dec 21, 2023
2 parents 4552b07 + e157b63 commit 9805300
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Script Image on Push

on:
push:
branches:
- main
paths:
- update-infra-deployments-task-scripts-image/Dockerfile

env:
REGISTRY: quay.io/redhat-appstudio
IMAGE_NAME: update-infra-deployments-task-script-image

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to Red Hat Registry
uses: redhat-actions/podman-login@v1
with:
registry: registry.redhat.io
username: ${{ secrets.REGISTRY_REDHAT_IO_USER }}
password: ${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }}

- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ github.sha }}
context: .
containerfiles: |
./update-infra-deployments-task-scripts-image/Dockerfile
- name: Push to Quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
60 changes: 60 additions & 0 deletions .github/workflows/check-author-in-owner-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Check Author

on:
pull_request:
branches:
- main
paths:
- update-infra-deployments-task-scripts-image/Dockerfile

jobs:
check-author:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Check the author
shell: bash
run: |
owners=$(yq e ".allowed_users.[]" OWNERS)
function exists_in_user_list() {
LIST=$1
DELIMITER=$2
VALUE=$3
LIST_WHITESPACES=`echo $LIST | tr "$DELIMITER" " "`
for x in $LIST_WHITESPACES; do
if [ "$x" = "$VALUE" ]; then
return 0
fi
done
return 1
}
if exists_in_user_list "$owners" " " ${{ github.actor }} ; then
echo "PR author is in the allowed users list"
exit 0
else
echo "PR author is NOT in the allowed users list"
exit 1
fi
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40

- name: Check if OWNERS file changed
shell: bash
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [ $file = "OWNERS" ]; then
echo "OWNERS file is changed"
exit 1
else
echo "OWNERS file is NOT changed"
fi
done
3 changes: 3 additions & 0 deletions update-infra-deployments-task-scripts-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM registry.redhat.io/openshift4/ose-cli:v4.11.0-202311302048.p0.g94eb522.assembly.stream

RUN dnf install -y git-core && dnf clean all

0 comments on commit 9805300

Please sign in to comment.