Skip to content

upstream

upstream #18634

Workflow file for this run

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
concurrency:
group: ${{ github.workflow }}-${{ inputs.pr-id }}
cancel-in-progress: true
env:
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@v4
- name: Notify Upstream about Pending
run: make notify-upstream org_admin_token=${{steps.generate_token.outputs.token}} upstream_sha=${{ github.event.inputs.upstream-sha }} state=pending run_id=${{ github.run_id }}
- uses: actions/setup-go@v5
with:
go-version: "1.19"
- name: Clone Fatmouse Repo
uses: actions/checkout@v4
with:
repository: Scalr/fatmouse
path: fatmouse
ref: ${{ env.API_BRANCH }}
token: ${{steps.generate_token.outputs.token}}
- name: Get Pull Request 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@v2
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Set Up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Copy secrets
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
run: gcloud auth configure-docker eu.gcr.io
- name: Pull Python Builder
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
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
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="${{ !contains(steps.pr-labels.outputs.labels, ' e2e:tev2_on_server ') && vars.TACO_APOOL_ID || '' }}" \
${{ env.RUN_TAG }}
- name: Get Scalr Hostname
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() }}
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 }}