Skip to content

SCALRCORE-31232: Can't request preview-saas container for provider PR… #1718

SCALRCORE-31232: Can't request preview-saas container for provider PR…

SCALRCORE-31232: Can't request preview-saas container for provider PR… #1718

Workflow file for this run

name: default
on:
push:
branches: [ master ]
paths-ignore:
- CHANGELOG.md
- CONTRIBUTING.md
- README.md
pull_request:
branches: [ master ]
paths-ignore:
- CHANGELOG.md
- CONTRIBUTING.md
- README.md
env:
RDME_VERSION: 0.0.4
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.19"
cache: false
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.56.1
args: --timeout 2m
- name: Validate Generated Code
run: |
go generate
if [ -z "$(git status --porcelain)" ]; then
echo "ok";
else
echo "*** Unexpected differences after code generation. Run 'go generate' and commit.";
exit 1;
fi
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.19"
- name: Run unit tests
run: make test
docs-preview:
name: Preview Docs
needs: [ lint ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Preview
uses: readmeio/rdme@v8
with:
rdme: docs ./docs --key=${{ secrets.README_API_KEY }} --version=${{ env.RDME_VERSION }} --dryRun
acc-tests:
runs-on: ubuntu-latest
name: acc-tests
env:
SCALR_TOKEN: ${{ secrets.SCALR_TOKEN }}
UPSTREAM_ID: ${{ github.run_number }}
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
- uses: actions/setup-go@v5
with:
go-version: "1.19"
- name: Check if Same Branch Exists in Fatmouse Repo
id: check-branch
uses: actions/github-script@v7
with:
github-token: ${{steps.generate_token.outputs.token}}
script: |
const owner = "Scalr";
const repo = "fatmouse";
const targetBranch = "${{ github.head_ref || github.ref_name }}";
const default_branch = "master";
try {
const { data: branch } = await github.request('GET /repos/{owner}/{repo}/branches/{branch}', {
owner: owner,
repo: repo,
branch: targetBranch
});
console.log(`Branch found in the ${repo} repository: ${branch.name}`);
core.setOutput('branch', branch.name);
} catch (error) {
if (error.status === 404) {
console.log(`Branch not found in ${repo} repository.`);
core.setOutput('branch', default_branch);
} else {
console.error('Unexpected error:', error);
core.setFailed('Unexpected error');
}
}
- name: Clone Fatmouse Repo
uses: actions/checkout@v4
with:
repository: Scalr/fatmouse
path: fatmouse
ref: ${{ steps.check-branch.outputs.branch }}
token: ${{steps.generate_token.outputs.token}}
- 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: |
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
- 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 ${{ github.head_ref || github.ref_name }} \
--run-url ${{ steps.get-job-id.outputs.html_url }} \
--skip-ui-build \
--ignore-missing-branches \
--agent-pool-id="${{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: Install Goveralls
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls
- name: Send Coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github
- 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 }}
upload-dev:
name: upload-dev
needs: [lint, unit-tests, acc-tests]
runs-on: ubuntu-latest
steps:
- name: Import GPG key
id: import_gpg
uses: Scalr/ghaction-import-gpg@v2.1.1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Set Up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.DEV_GCP_PROJECT_ID }}
service_account_key: ${{ secrets.DEV_GCP_SA_KEY }}
export_default_credentials: true
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Development Tag
run: |
BRANCH=${{ github.head_ref || github.ref_name }}
git tag v1.0.0-rc-$BRANCH
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.19"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: v1.8.3
args: release --skip-publish
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Upload Provider to Registry
uses: ./.github/actions/upload-provider
with:
gcs-bucket: ${{ secrets.DEV_BUCKET_NAME }}
registry-domain: ${{ secrets.DEV_DOMAIN }}
gpg-key-id: ${{ steps.import_gpg.outputs.fingerprint }}
gpg-pub-key: ${{ steps.import_gpg.outputs.pubkey }}
- name: Update Network Mirror
uses: ./.github/actions/update-network-mirror
with:
gcs-bucket: ${{ secrets.DEV_BUCKET_NAME }}
registry-domain: ${{ secrets.DEV_DOMAIN }}
dry-run: false