Added rbac explanatory steps... #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build, Test, and Push Docker Images | Running in parallel | |
name: Continuous Integration | ELK | MDEForge-Search | |
on: | |
push: | |
branches: | |
- main | |
env: | |
SKIP_CI: "true" | |
jobs: | |
check-skip: | |
runs-on: ubuntu-latest | |
outputs: | |
skip: ${{ steps.set-skip.outputs.skip }} | |
steps: | |
- name: Check if CI should be skipped | |
id: set-skip | |
run: echo "::set-output name=skip::${{ env.SKIP_CI }}" | |
build-and-test-elk: | |
needs: check-skip | |
runs-on: ubuntu-latest | |
if: ${{ needs.check-skip.outputs.skip != 'true' }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build images | |
run: | | |
IMAGE_TAG=${{ github.sha }} | |
IMAGE_TAG=$(echo ${IMAGE_TAG} | cut -c 1-8) | |
docker build ./elastic-bundle/elasticsearch --tag indamutsa/elasticsearch:$IMAGE_TAG | |
docker build ./elastic-bundle/logstash --tag indamutsa/logstash:$IMAGE_TAG | |
docker build ./elastic-bundle/kibana --tag indamutsa/kibana:$IMAGE_TAG | |
docker build ./elastic-bundle/filebeat --tag indamutsa/filebeat:$IMAGE_TAG | |
- name: Run docker-compose | |
run: | | |
IMAGE_TAG=${{ github.sha }} | |
export IMAGE_TAG=$(echo ${IMAGE_TAG} | cut -c 1-8) | |
docker-compose -f .github/workflows/testing-files/elk-compose.yml up -d --build | |
- name: Test the ELK stack | |
run: | | |
# Run the test script | |
chmod +x ./.github/workflows/testing-files/elk-test.sh | |
./.github/workflows/testing-files/elk-test.sh || (docker-compose -f .github/workflows/testing-files/elk-compose.yml logs && exit 1) | |
- name: Log into Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Push images | |
run: | | |
IMAGE_TAG=${{ github.sha }} | |
IMAGE_TAG=$(echo ${IMAGE_TAG} | cut -c 1-8) | |
docker push indamutsa/elasticsearch:$IMAGE_TAG | |
docker push indamutsa/logstash:$IMAGE_TAG | |
docker push indamutsa/kibana:$IMAGE_TAG | |
docker push indamutsa/filebeat:$IMAGE_TAG |