Skip to content

Commit 4d4de10

Browse files
authored
Merge pull request #620 from mbaldessari/pattern-sh-ci-job
Add a CI job for pattern.sh
2 parents c0c2c1e + 46af202 commit 4d4de10

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

.github/workflows/pattern-sh-ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Run Bash Script on Multiple Distributions
2+
3+
on:
4+
push:
5+
paths:
6+
- "scripts/**"
7+
- "Makefile"
8+
branches:
9+
- main
10+
pull_request:
11+
paths:
12+
- "scripts/**"
13+
- "Makefile"
14+
15+
jobs:
16+
run-script:
17+
name: Run Bash Script
18+
strategy:
19+
matrix:
20+
# Fedora is not an option yet
21+
os: [ubuntu-latest, ubuntu-22.04]
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v4
27+
28+
- name: Install Podman on Ubuntu
29+
if: contains(matrix.os, 'ubuntu')
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y podman
33+
34+
# Currently we do not do MacOSX as it is not free, maybe in the future
35+
# - name: Install Podman on macOS
36+
# if: contains(matrix.os, 'macos')
37+
# run: |
38+
# brew install podman
39+
# podman machine init
40+
# podman machine start
41+
42+
- name: Verify Podman Installation
43+
run: podman --version
44+
45+
- name: Run pattern.sh script
46+
run: |
47+
export TARGET_BRANCH=main
48+
./scripts/pattern-util.sh make validate-origin

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ TARGET_ORIGIN ?= origin
1818
# This is because we expect to use tokens for repo authentication as opposed to SSH keys
1919
TARGET_REPO=$(shell git ls-remote --get-url --symref $(TARGET_ORIGIN) | sed -e 's/.*URL:[[:space:]]*//' -e 's%^git@%%' -e 's%^https://%%' -e 's%:%/%' -e 's%^%https://%')
2020
# git branch --show-current is also available as of git 2.22, but we will use this for compatibility
21-
TARGET_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
21+
TARGET_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
2222

2323
UUID_FILE ?= ~/.config/validated-patterns/pattern-uuid
2424
UUID_HELM_OPTS ?=

scripts/pattern-util.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ podman run -it --rm --pull=newer \
8888
-e EXTRA_PLAYBOOK_OPTS \
8989
-e TARGET_ORIGIN \
9090
-e TARGET_SITE \
91+
-e TARGET_BRANCH \
9192
-e NAME \
9293
-e TOKEN_SECRET \
9394
-e TOKEN_NAMESPACE \

0 commit comments

Comments
 (0)