Skip to content

Commit

Permalink
runner image and arc changes (apache#27118)
Browse files Browse the repository at this point in the history
* runner image and arc changes

* add state bucket comment in env file for reference

* add readme for manual image push and sync beam environment

---------

Co-authored-by: vdjerek <Vlado Djerek>
  • Loading branch information
volatilemolotov authored and cushon committed May 24, 2024
1 parent df32eae commit b7575ce
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ spec:
- "self-hosted"
env: []
resources:
limits:
cpu: "4.0"
memory: "8Gi"
# limits:
# cpu: "4.0"
# memory: "8Gi"
requests:
cpu: "500m"
memory: "500Mi"
11 changes: 6 additions & 5 deletions .github/gh-actions-self-hosted-runners/arc/environments/beam.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ zone = "us-west1-b"
min_main_node_count = "1"
max_main_node_count = "5"
environment = "beam"
ingress_domain = "runners.example.com"
ingress_domain = "action.beam.apache.org"
organization = "apache"
repository = "beam"
github_app_id_secret_name = "gh-app_id"
github_app_install_id_secret_name = "gh-app_installation_id"
github_private_key_secret_name = "gh-pem_key"
deploy_webhook = "false"
max_main_replicas = "40"
deploy_webhook = "true"
max_main_replicas = "50"
min_main_replicas = "5"
webhook_scaling = "false"
webhook_scaling = "true"
runner_group = "beam"
machine_type = "e2-standard-16"
machine_type = "e2-standard-16"
#state_bucket_name = "beam-arc-state"
1 change: 0 additions & 1 deletion .github/gh-actions-self-hosted-runners/arc/gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ resource "google_container_node_pool" "actions-runner-pool" {
}
node_config {
machine_type = var.machine_type
service_account = google_service_account.actions_service_account.email
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
Expand Down
7 changes: 0 additions & 7 deletions .github/gh-actions-self-hosted-runners/arc/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
# specific language governing permissions and limitations
# under the License.
#

resource "google_service_account" "actions_service_account" {
account_id = "${var.environment}-runner-gke-sa"
display_name = "${var.environment}-runner-gke-sa"
}


data "google_client_config" "provider" {}

data "google_client_openid_userinfo" "provider_identity" {
Expand Down
52 changes: 52 additions & 0 deletions .github/gh-actions-self-hosted-runners/arc/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#


FROM ghcr.io/actions-runner-controller/actions-runner-controller/actions-runner:ubuntu-20.04

USER root
#Install Node
RUN curl -OL https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz && \
tar -C /usr/local -xf node-v18.16.0-linux-x64.tar.xz && \
rm node-v18.16.0-linux-x64.tar.xz && \
mv /usr/local/node-v18.16.0-linux-x64 /usr/local/node
ENV PATH="${PATH}:/usr/local/node/bin"
#Install Go
ARG go_version=1.20.4
RUN curl -OL https://go.dev/dl/go${go_version}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${go_version}.linux-amd64.tar.gz && \
rm go${go_version}.linux-amd64.tar.gz
ENV PATH="${PATH}:/usr/local/go/bin"
#Install Java
RUN curl -OL https://cdn.azul.com/zulu/bin/zulu8.70.0.23-ca-jdk8.0.372-linux_x64.tar.gz && \
tar -C /usr/local -xzf zulu8.70.0.23-ca-jdk8.0.372-linux_x64.tar.gz && \
rm zulu8.70.0.23-ca-jdk8.0.372-linux_x64.tar.gz && \
mv /usr/local/zulu8.70.0.23-ca-jdk8.0.372-linux_x64 /usr/local/java
ENV PATH="${PATH}:/usr/local/java/bin"
#Install Gradle
RUN curl -OL https://services.gradle.org/distributions/gradle-7.3.3-bin.zip && \
unzip gradle-7.3.3-bin.zip && \
rm gradle-7.3.3-bin.zip && \
mv gradle-7.3.3 /usr/local/gradle
ENV PATH="${PATH}:/usr/local/gradle/bin"


# Needed to transfer path addtitions to runner environment
RUN echo PATH=$PATH >> /runnertmp/.env
USER runner
36 changes: 36 additions & 0 deletions .github/gh-actions-self-hosted-runners/arc/images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# Manual build and push

First set a tag you want to use:
```
export RUNNER_IMAGE_TAG=some_tag
```
After which you run the build command:
```
docker build -t us-central1-docker.pkg.dev/apache-beam-testing/beam-github-actions/beam-arc-runner:$RUNNER_IMAGE_TAG -t us-central1-docker.pkg.dev/apache-beam-testing/beam-github-actions/beam-arc-runner:$(git rev-parse --short HEAD) .
```
This builds and tags the image with both the Git SHA and desired tag set.

Authenticate to the docker repository in GCP with:
```
gcloud auth configure-docker us-central1-docker.pkg.dev
```
docker push us-central1-docker.pkg.dev/apache-beam-testing/beam-github-actions/beam-arc-runner:$RUNNER_IMAGE_TAG
docker push us-central1-docker.pkg.dev/apache-beam-testing/beam-github-actions/beam-arc-runner:$(git rev-parse --short HEAD)
```
49 changes: 49 additions & 0 deletions .github/workflows/build_runner_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: Build and Version Runner Docker Image

on:
pull_request_target:
branches: ['master']
paths: ['.github/gh-actions-self-hosted-runners/arc/images/**']

jobs:
build-and-version-runner:
env:
working-directory: .github/gh-actions-self-hosted-runners/arc/images/
runs-on: [self-hosted, ubuntu-20.04]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: ${{ env.working-directory }}
push: false
tags: |
us-central1-docker.pkg.dev/apache-beam-testing/beam-github-actions/beam-arc-runner:latest
us-central1-docker.pkg.dev/apache-beam-testing/beam-github-actions/beam-arc-runner:${{ github.sha }}

0 comments on commit b7575ce

Please sign in to comment.