This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
Update README.md #1
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
# The main "setup" workflow, that calls other workflows. | ||
name: Docker Images Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v*.*.* | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
permissions: | ||
contents: read | ||
# Agent Docker image tests | ||
# | ||
# To test this workflow with your branch, make the following changes: | ||
# | ||
# 1. In this workflow, change ``@master`` to ``@your_branch_name`` - e.g. ``@docker_image_alpine`` | ||
# 2. In this workflow, change docker hub secrets to utilize testing and not prod account so images | ||
# get pushed to testing account. Change ``_PROD_` in the secret name to ``_TEST``, | ||
# e.g. ``DOCKER_HUB_USERNAME_TEST_ACCOUNT`` ``DOCKER_HUB_PASSWORD_TEST_ACCOUNT``. | ||
# Images for test account will get pushed to https://hub.docker.com/r/test4scalyr/. | ||
# | ||
# 3. In the job 'publish-images' below, change 'refs/heads/improve-caching-test' in the job conditional to you current branch.: | ||
# | ||
# For example: https://github.com/scalyr/scalyr-agent-2/pull/804/commits/0eccf278623552b51d9289d75a47794e88f02862 | ||
jobs: | ||
pre_job: | ||
name: Skip Duplicate Jobs Pre Job | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write # Needed for skip-duplicate-jobs job | ||
contents: read | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281 # v4.0.0 | ||
with: | ||
cancel_others: 'true' | ||
github_token: ${{ github.token }} | ||
test-images: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
image-type: [ "docker-json", "docker-syslog", "docker-api", "k8s" ] | ||
image-distro-name: [ "debian", "alpine" ] | ||
python-version: [ "3.8.13" ] | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
# Set this variable to tell the agent build code that it runs in CI/CD and it needs to use caching. | ||
AGENT_BUILD_IN_CICD: "1" | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Install python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Perform the deployment of the test environment | ||
uses: ./.github/actions/perform-deployment | ||
with: | ||
deployment-name: "test_environment" | ||
- name: Sanity check deployments logic by running internal tests | ||
run: | | ||
python3 -m pytest agent_build/tools/tests | ||
- name: Set up QEMU | ||
id: qemu | ||
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2 | ||
with: | ||
image: tonistiigi/binfmt:qemu-v6.2.0 | ||
platforms: all | ||
- name: Perform the build of the base docker image in the deployment. | ||
uses: ./.github/actions/perform-deployment | ||
with: | ||
deployment-name: ${{ matrix.image-type }}-${{ matrix.image-distro-name }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@ecf95283f03858871ff00b787d79c419715afc34 # v2.0.0 | ||
with: | ||
driver-opts: network=host | ||
- name: Start minikube for the test of the kubernetes build | ||
if: contains(matrix.image-type, 'k8s') | ||
shell: bash | ||
run: | | ||
minikube start | ||
echo "" | ||
echo "kubectl version" | ||
kubectl version | ||
echo "" | ||
echo "kubectl cluster-info" | ||
echo "" | ||
kubectl cluster-info | ||
- name: Run image test | ||
env: | ||
SCALYR_API_KEY: ${{ secrets.CT_SCALYR_TOKEN_PROD_US_CLOUDTECH_TESTING_WRITE }} | ||
run: | | ||
python3 tests/package_tests/run_package_test.py package-test \ | ||
"${{ matrix.image-type }}-${{ matrix.image-distro-name }}_test" \ | ||
--name-suffix "_${{ github.run_number }}${{ github.run_attempt }}" \ | ||
- name: Notify Slack on Failure | ||
if: ${{ failure() && github.ref_name == 'master' }} | ||
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
with: | ||
status: ${{ job.status }} | ||
steps: ${{ toJson(steps) }} | ||
channel: '#eng-dataset-cloud-tech' | ||
publish-images: | ||
if: ${{ github.ref_name == 'master' || github.ref_type == 'tag' }} | ||
needs: | ||
- test-images | ||
uses: scalyr/scalyr-agent-2/.github/workflows/reusable-publish-docker-images.yml@master | ||
Check failure on line 135 in .github/workflows/agent-build.yml GitHub Actions / .github/workflows/agent-build.ymlInvalid workflow file
|
||
secrets: | ||
SCALYR_PROD_CLOUDTECH_TESTING_WRITE_TOKEN: ${{ secrets.CT_SCALYR_TOKEN_PROD_US_CLOUDTECH_TESTING_WRITE }} | ||
SCALYR_CLOUDTECH_TESTING_DEV_SCALYR_READ_API_KEY: ${{ secrets.CT_SCALYR_TOKEN_PROD_US_CLOUDTECH_TESTING_READ }} | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME_PROD_ACCOUNT }} | ||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD_PROD_ACCOUNT }} |