Multiple messages. Log openstack reason #377
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
name: build-push-image | |
on: push | |
# At the moment, the environments test and prod are somewhat a copy of each others | |
# github actions does not support yaml anchors but does have something they call composite steps: | |
# https://docs.github.com/en/actions/creating-actions/about-actions#composite-run-steps-actions | |
# which we need to take a look at in the future | |
jobs: | |
app: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CR_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: fetch repository | |
uses: actions/checkout@master | |
- name: Set GITHUB_SHA_SHORT | |
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
"PACKAGES_USERNAME=${{ secrets.PACKAGES_USERNAME }}" | |
"PACKAGES_TOKEN=${{ secrets.PACKAGES_TOKEN }}" | |
push: true | |
tags: | | |
ghcr.io/aau-claaudia/openstackgateway:${{ env.GITHUB_SHA_SHORT }} | |
- name: Build documentation | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.x | |
- run: pip install mkdocs-material | |
- run: mkdocs gh-deploy --force | |
test: | |
runs-on: ubuntu-latest | |
needs: app | |
environment: | |
name: test | |
url: https://openstackgateway-test.germanywestcentral.cloudapp.azure.com | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
HOSTNAME: openstackgateway-test.germanywestcentral.cloudapp.azure.com | |
steps: | |
- name: fetch repository | |
uses: actions/checkout@master | |
- name: Set GITHUB_SHA_SHORT | |
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV | |
- name: Setup ssh agent | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | |
- name: Play Ansible Playbook | |
uses: arillso/action.playbook@master | |
with: | |
playbook: infrastructure/ansible/playbook.yml | |
inventory: infrastructure/ansible/inventory-${{ github.job }} | |
private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
galaxy_file: infrastructure/ansible/requirements.yml | |
ssh_common_args: "\"-oUserKnownHostsFile=infrastructure/known_hosts\"" | |
- name: Make a temporary directory | |
run: echo "SERVICE_DIRECTORY=$(ssh -o UserKnownHostsFile=infrastructure/known_hosts -lazureuser ${{ env.HOSTNAME }} mktemp -d)" >> $GITHUB_ENV | |
- name: Copy service definition | |
run: scp -o UserKnownHostsFile=infrastructure/known_hosts -r infrastructure/service azureuser@${{ env.HOSTNAME }}:${{ env.SERVICE_DIRECTORY }} | |
- name: Deploy new service definition | |
run: | | |
ssh -o UserKnownHostsFile=infrastructure/known_hosts -lazureuser ${{ env.HOSTNAME }} \ | |
sudo docker swarm init || true | |
ssh -o UserKnownHostsFile=infrastructure/known_hosts -lazureuser ${{ env.HOSTNAME }} \ | |
SITE_HOST=${{ env.HOSTNAME }} OSG_SHA=${{ env.GITHUB_SHA_SHORT }} SPRING_PROFILE=${{ github.job }} \ | |
sudo -E docker stack deploy --prune -c ${{ env.SERVICE_DIRECTORY }}/service/stack.yml osg | |
prod: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' # run this job only for the main branch | |
needs: app | |
environment: | |
name: prod | |
url: https://openstackgateway.germanywestcentral.cloudapp.azure.com | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
HOSTNAME: openstackgateway.germanywestcentral.cloudapp.azure.com | |
steps: | |
- name: fetch repository | |
uses: actions/checkout@master | |
- name: Set GITHUB_SHA_SHORT | |
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV | |
- name: Setup ssh agent | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | |
- name: Play Ansible Playbook | |
uses: arillso/action.playbook@master | |
with: | |
playbook: infrastructure/ansible/playbook.yml | |
inventory: infrastructure/ansible/inventory-${{ github.job }} | |
private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
galaxy_file: infrastructure/ansible/requirements.yml | |
ssh_common_args: "\"-oUserKnownHostsFile=infrastructure/known_hosts\"" | |
- name: Make a temporary directory | |
run: echo "SERVICE_DIRECTORY=$(ssh -o UserKnownHostsFile=infrastructure/known_hosts -lazureuser ${{ env.HOSTNAME }} mktemp -d)" >> $GITHUB_ENV | |
- name: Copy service definition | |
run: scp -o UserKnownHostsFile=infrastructure/known_hosts -r infrastructure/service azureuser@${{ env.HOSTNAME }}:${{ env.SERVICE_DIRECTORY }} | |
- name: Deploy new service definition | |
run: | | |
ssh -o UserKnownHostsFile=infrastructure/known_hosts -lazureuser ${{ env.HOSTNAME }} \ | |
sudo docker swarm init || true | |
ssh -o UserKnownHostsFile=infrastructure/known_hosts -lazureuser ${{ env.HOSTNAME }} \ | |
SITE_HOST=${{ env.HOSTNAME }} OSG_SHA=${{ env.GITHUB_SHA_SHORT }} SPRING_PROFILE=${{ github.job }} \ | |
sudo -E docker stack deploy --prune -c ${{ env.SERVICE_DIRECTORY }}/service/stack.yml osg |