New Consul release version null #18
This file contains hidden or 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: Scenario testing for local environment | |
| # Controls when the action will run. Workflow runs when manually triggered. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| CONSUL_VERSION: | |
| description: 'Consul version for the testing' | |
| required: true | |
| default: 'latest' | |
| push: | |
| paths: | |
| - '.github/workflows/release_version/*' | |
| env: | |
| WORKFLOW_STEP_REPORT: /home/runner/workflow.log | |
| JIRA_DESCRIPTION_FILE: /home/runner/description.md | |
| TUTORIAL_TITLE: "Getting started with Consul on VMs - Local" | |
| permissions: | |
| contents: write # required permission to delete artifact | |
| actions: write | |
| packages: write | |
| id-token: write | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "greet" | |
| build_and_run_local: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Prerequisites | |
| run: | | |
| touch $WORKFLOW_STEP_REPORT | |
| ln $WORKFLOW_STEP_REPORT workflow.log | |
| touch $JIRA_DESCRIPTION_FILE | |
| ln $JIRA_DESCRIPTION_FILE description.md | |
| echo "Install prerequisites step" > $WORKFLOW_STEP_REPORT | |
| echo "# Automated testing for $TUTORIAL_TITLE" > $JIRA_DESCRIPTION_FILE | |
| echo -n "* Install prerequisites..." >> $JIRA_DESCRIPTION_FILE | |
| sudo apt-get update && sudo apt-get install -y gnupg software-properties-common | |
| wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null | |
| gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint | |
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
| sudo apt update | |
| sudo apt-get install terraform | |
| echo "DONE" >> $JIRA_DESCRIPTION_FILE | |
| - name: Build Docker Images | |
| run: | | |
| echo "Build Docker Images" > $WORKFLOW_STEP_REPORT | |
| echo -n "* Build Docker Images..." >> $JIRA_DESCRIPTION_FILE | |
| cd self-managed/infrastructure/docker/images | |
| ./generate_variables.sh ${{ inputs.CONSUL_VERSION }} | |
| echo `cat variables.env | grep CONSUL_VERSION` >> $GITHUB_ENV | |
| ./build_images.sh | tee -a $WORKFLOW_STEP_REPORT | |
| echo "DONE" >> $JIRA_DESCRIPTION_FILE | |
| cat variables.env >> $JIRA_DESCRIPTION_FILE | |
| - name: Run GS 1 - Deploy Consul on VMs | |
| run: | | |
| echo "Run GS 1 - Deploy Consul on VMs" > $WORKFLOW_STEP_REPORT | |
| echo "## Run GS 1 - Deploy Consul on VMs" >> $JIRA_DESCRIPTION_FILE | |
| cd self-managed/infrastructure/docker | |
| terraform init | tee -a $WORKFLOW_STEP_REPORT | |
| terraform destroy --auto-approve | tee -a $WORKFLOW_STEP_REPORT | |
| terraform apply --auto-approve --var-file=../../ops/conf/GS_00_base_scenario.tfvars -var="solve_scenario=true" | tee -a $WORKFLOW_STEP_REPORT | |
| echo "SUCCESS" >> $JIRA_DESCRIPTION_FILE | |
| - name: Run GS 2 - Register your services to Consul | |
| run: | | |
| echo "Run GS 2 - Register your services to Consul" > $WORKFLOW_STEP_REPORT | |
| echo "## Run GS 2 - Register your services to Consul" >> $JIRA_DESCRIPTION_FILE | |
| cd self-managed/infrastructure/docker | |
| terraform init | tee -a $WORKFLOW_STEP_REPORT | |
| terraform destroy --auto-approve | tee -a $WORKFLOW_STEP_REPORT | |
| terraform apply --auto-approve --var-file=../../ops/conf/GS_01_deploy_consul.tfvars -var="solve_scenario=true" | tee -a $WORKFLOW_STEP_REPORT | |
| echo "SUCCESS" >> $JIRA_DESCRIPTION_FILE | |
| # Think about using API for creating a ticket https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post | |
| - name: Create Jira report | |
| uses: bryannice/gitactions-jira-issue-creation@master | |
| if: failure() | |
| env: | |
| JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
| JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} | |
| JIRA_ACCOUNT_URL: https://hashicorp.atlassian.net/ | |
| JIRA_PROJECT: CE | |
| JIRA_ISSUE_TYPE: Tutorial bug report | |
| JIRA_ISSUE_SUMMARY: Failed local build for ${{ env.TUTORIAL_TITLE }} for Consul ${{ env.CONSUL_VERSION }}. | |
| JIRA_ISSUE_DESCRIPTION: Failed local build for ${{ env.TUTORIAL_TITLE }} for Consul ${{ env.CONSUL_VERSION }}. Check attachments for more info. | |
| JIRA_ISSUE_ATTACHMENT: workflow.log | |
| - name: Release and publish | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ./runbooks/self_managed-docker* | |
| tag: ${{ env.CONSUL_VERSION }} | |
| overwrite: true | |
| file_glob: true | |
| body: "Automated release for Consul ${{ env.CONSUL_VERSION }}" |