Skip to content

prepare_jenkins

prepare_jenkins #72

name: prepare_jenkins
on:
push:
branches:
- main
paths:
- jenkins/**
workflow_dispatch:
concurrency:
group: prepare_jenkins
cancel-in-progress: true
jobs:
build_docker:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jenkins
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Pull repository
uses: actions/checkout@v2
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/jenkins:${{ github.sha }}
context: jenkins/docker
prepare_head_node:
# needs: build_docker
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./jenkins
env:
OAUTH_CLIENT_ID_PROD: ${{ secrets.OAUTH_CLIENT_ID_PROD }}
OAUTH_CLIENT_SECRET_PROD: ${{ secrets.OAUTH_CLIENT_SECRET_PROD }}
JENKINS_READER_APP_KEY: ${{ secrets.JENKINS_READER_APP_KEY }}
OCTOML_RELAX_CI_GITHUB_APP_KEY: ${{ secrets.OCTOML_RELAX_CI_GITHUB_APP_KEY }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
JENKINS_PRIV_KEY_PROD: ${{ secrets.JENKINS_PRIV_KEY_PROD }}
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_TOKEN_TLCPACKSTAGING: ${{ secrets.DOCKERHUB_TOKEN_TLCPACKSTAGING }}
DOCKERHUB_TOKEN_TLCPACK: ${{ secrets.DOCKERHUB_TOKEN_TLCPACK }}
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_AWS_SECRET_ACCESS_KEY }}
TQCHEN_CI_PAT: ${{ secrets.TQCHEN_CI_PAT }}
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
DOCS_PUSH_TOKEN: ${{ secrets.DOCS_PUSH_TOKEN }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
TVM_BOT_DOCS_GITHUB_TOKEN: ${{ secrets.TVM_BOT_GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
steps:
-
name: Pull repository
uses: actions/checkout@v2
-
name: Pull Terraform state
run: ./scripts/pull_terraform_backend.sh
-
name: Source common environment variables to be used in ansible playbook
run: source ./scripts/common.sh
-
name: Write ansible key to file
run: echo "${{ secrets.GLOBAL_NODE_ACCESS_PRIVATE_KEY }}" > global_node_access_private_key
-
name: Set permissions on key file
run: chmod 600 global_node_access_private_key
-
name: Run Ansible playbook
run: ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ansible_inventory.txt -u ubuntu -b --private-key=global_node_access_private_key ansible/playbooks/jenkins.yaml