diff --git a/.github/workflows/elasticsearch.yml b/.github/workflows/elasticsearch.yml index f80371e..e3f8910 100644 --- a/.github/workflows/elasticsearch.yml +++ b/.github/workflows/elasticsearch.yml @@ -2,9 +2,7 @@ name: Elasticsearch Docker Image CI on: push: - branches: [ "7.17", "8.17", "8.18", "8.19", "9.0", "9.1"] pull_request: - branches: [ "7.17", "8.17", "8.18", "8.19", "9.0", "9.1"] jobs: @@ -15,5 +13,18 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # Check if directory exists - needed because main branch doesn't contain Dockerfiles + # (see README.md for branch model documentation) + - name: Check if elasticsearch directory exists + id: check_dir + run: | + if [ ! -d "elasticsearch" ]; then + echo "exists=false" >> $GITHUB_OUTPUT + echo "Directory elasticsearch does not exist, skipping build" + else + echo "exists=true" >> $GITHUB_OUTPUT + fi + - name: Build the Elasticsearch Docker image + if: steps.check_dir.outputs.exists == 'true' run: docker build elasticsearch diff --git a/.github/workflows/kibana.yml b/.github/workflows/kibana.yml index 2888409..3a69115 100644 --- a/.github/workflows/kibana.yml +++ b/.github/workflows/kibana.yml @@ -2,9 +2,7 @@ name: Kibana Docker Image CI on: push: - branches: [ "7.17", "8.17", "8.18", "8.19", "9.0", "9.1"] pull_request: - branches: [ "7.17", "8.17", "8.18", "8.19", "9.0", "9.1"] jobs: @@ -15,5 +13,18 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # Check if directory exists - needed because main branch doesn't contain Dockerfiles + # (see README.md for branch model documentation) + - name: Check if kibana directory exists + id: check_dir + run: | + if [ ! -d "kibana" ]; then + echo "exists=false" >> $GITHUB_OUTPUT + echo "Directory kibana does not exist, skipping build" + else + echo "exists=true" >> $GITHUB_OUTPUT + fi + - name: Build the Kibana Docker image + if: steps.check_dir.outputs.exists == 'true' run: docker build kibana diff --git a/.github/workflows/logstash.yml b/.github/workflows/logstash.yml index 849302f..5d14aa0 100644 --- a/.github/workflows/logstash.yml +++ b/.github/workflows/logstash.yml @@ -2,9 +2,7 @@ name: Logstash Docker Image CI on: push: - branches: ["8.17", "8.18", "8.19", "9.0", "9.1"] pull_request: - branches: ["8.17", "8.18", "8.19", "9.0", "9.1"] jobs: @@ -15,5 +13,18 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # Check if directory exists - needed because main branch doesn't contain Dockerfiles + # (see README.md for branch model documentation) + - name: Check if logstash directory exists + id: check_dir + run: | + if [ ! -d "logstash" ]; then + echo "exists=false" >> $GITHUB_OUTPUT + echo "Directory logstash does not exist, skipping build" + else + echo "exists=true" >> $GITHUB_OUTPUT + fi + - name: Build the Logstash Docker image + if: steps.check_dir.outputs.exists == 'true' run: docker build logstash