upstream #17315
Workflow file for this run
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: upstream | |
on: | |
workflow_dispatch: | |
inputs: | |
upstream-sha: | |
description: "Upstream commit SHA" | |
required: true | |
api-branch: | |
description: "API Branch" | |
required: true | |
default: "master" | |
db-branch: | |
description: "Not used, left for backward compatibility" | |
required: false | |
default: "master" | |
py-req: | |
description: "Whether to upgrade python requirements" | |
required: false | |
default: "no" | |
upstream-base-ref: | |
description: "Upstream base branch (e.g. 'master' or 'release/8.57.0')" | |
required: false | |
pr-id: | |
description: The number of the pull request | |
required: false | |
jobs: | |
acc-tests: | |
runs-on: ubuntu-latest | |
name: acc-tests | |
env: | |
ORG_ADMIN_TOKEN: ${{ secrets.ORG_ADMIN_TOKEN }} | |
SCALR_TOKEN: ${{ secrets.SCALR_TOKEN }} | |
API_BRANCH: ${{ github.event.inputs.api-branch }} | |
PY_REQ: ${{ github.event.inputs.py-req }} | |
UPSTREAM_ID: ${{ github.run_number }} | |
UPSTREAM_BASE_REF: ${{ github.event.inputs.upstream-base-ref }} | |
steps: | |
- name: Sudo GitHub Token | |
id: generate_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{vars.SUDO_GHA_APP_ID}} | |
installation_id: ${{vars.SUDO_GHA_APP_INSTALLATION_ID}} | |
private_key: ${{secrets.SUDO_GHA_APP_PRIVATE_KEY}} | |
- uses: actions/checkout@v3 | |
- name: Notify upstream about pending | |
run: make notify-upstream upstream_sha=${{ github.event.inputs.upstream-sha }} state=pending run_id=${{ github.run_id }} | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: "1.18" | |
- name: Clone fatmouse repo | |
uses: actions/checkout@v3 | |
with: | |
repository: Scalr/fatmouse | |
path: fatmouse | |
ref: ${{ env.API_BRANCH }} | |
token: ${{steps.generate_token.outputs.token}} | |
- name: Get pr labels | |
id: pr-labels | |
if: ${{ inputs.pr-id != '' }} | |
uses: ./fatmouse/.github/actions/pr-labels | |
with: | |
github_token: ${{steps.generate_token.outputs.token}} | |
owner: Scalr | |
repo: fatmouse | |
pr_id: ${{ inputs.pr-id }} | |
- name: Set py-req on PR with label | |
if: ${{ inputs.pr-id != '' && contains(steps.pr-labels.outputs.labels, ' py-req ') }} | |
run: echo "PY_REQ=yes" >> $GITHUB_ENV | |
- id: auth | |
uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v0 | |
- name: Copy secrets | |
shell: bash | |
run: | | |
mkdir ~/.scalr-labs | |
gsutil cp gs://tacobell_development-156220/.secrets.yaml fatmouse/tacobell/.secrets.yaml | |
gsutil cp gs://tacobell_development-156220/github.json ~/.scalr-labs/github.json | |
- name: Configure docker | |
shell: bash | |
run: gcloud auth configure-docker eu.gcr.io | |
- name: Pull python builder | |
shell: bash | |
run: | | |
echo "::group::Pull python builder image" | |
docker pull eu.gcr.io/development-156220/fatmouse/python-builder:master | |
docker tag eu.gcr.io/development-156220/fatmouse/python-builder:master fatmouse/python-builder:master | |
echo "::endgroup::" | |
- name: Get current job log URL | |
uses: Tiryoh/gha-jobid-action@v0 | |
id: get-job-id | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
job_name: ${{ github.job }} | |
- name: Generate run tag | |
shell: bash | |
run: | | |
if [ ${{ github.run_attempt }} = 1 ]; then | |
RERUN_SUFFIX="" | |
else | |
RERUN_SUFFIX=$(echo -${{ github.run_attempt }}) | |
fi | |
echo "RUN_TAG=e2e-${{ github.workflow }}-${{ github.job }}-${{ github.run_number }}${RERUN_SUFFIX}" >> $GITHUB_ENV | |
- name: Create container | |
id: create | |
shell: bash | |
run: | | |
docker run --rm \ | |
-e GITHUB_WORKSPACE=true \ | |
-e GITHUB_OUTPUT=/fatmouse/output \ | |
-w /fatmouse \ | |
-v $PWD/fatmouse:/fatmouse \ | |
-v $GITHUB_OUTPUT:/fatmouse/output \ | |
-v ~/.scalr-labs:/etc/scalr-labs \ | |
fatmouse/python-builder:master python -u clickfile.py te up \ | |
--branch ${{ env.API_BRANCH }} \ | |
--run-url ${{ steps.get-job-id.outputs.html_url }} \ | |
--skip-ui-build \ | |
--agent-pool-id="${{vars.TACO_APOOL_ID}}" \ | |
${{ env.RUN_TAG }} | |
- name: Get Scalr hostname | |
shell: bash | |
run: | | |
SCALR_HOST=${{ steps.create.outputs.host }} | |
echo "SCALR_HOSTNAME=mainiacp.${SCALR_HOST/https:\/\//}" >> $GITHUB_ENV | |
- name: Run acceptance tests | |
env: | |
SCALR_HOSTNAME: ${{ env.SCALR_HOSTNAME }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }} | |
TEST_AWS_SECRET_KEY: ${{ secrets.TEST_AWS_SECRET_KEY }} | |
TEST_AWS_ROLE_ARN: ${{ secrets.TEST_AWS_ROLE_ARN }} | |
TEST_AWS_EXTERNAL_ID: ${{ secrets.TEST_AWS_EXTERNAL_ID }} | |
TEST_ARM_CLIENT_ID: ${{ secrets.TEST_ARM_CLIENT_ID }} | |
TEST_ARM_CLIENT_SECRET: ${{ secrets.TEST_ARM_CLIENT_SECRET }} | |
TEST_ARM_TENANT_ID: ${{ secrets.TEST_ARM_TENANT_ID }} | |
TEST_ARM_SUBSCRIPTION_ID: ${{ secrets.TEST_ARM_SUBSCRIPTION_ID }} | |
run: make testacc | |
- name: Delete container | |
id: delete | |
if: ${{ always() }} | |
shell: bash | |
run: | | |
docker run --rm \ | |
-w /fatmouse \ | |
-v $PWD/fatmouse:/fatmouse \ | |
-v ~/.scalr-labs:/etc/scalr-labs \ | |
fatmouse/python-builder:master \ | |
python -u clickfile.py te rm \ | |
--no-wait ${{ env.RUN_TAG }} | |
- name: Notify upstream about success | |
if: ${{ success() }} | |
run: make notify-upstream upstream_sha=${{ github.event.inputs.upstream-sha }} state=success run_id=${{ github.run_id }} | |
- name: Notify upstream about failure | |
if: ${{ failure() }} | |
run: make notify-upstream upstream_sha=${{ github.event.inputs.upstream-sha }} state=failure run_id=${{ github.run_id }} |