Skip to content

Commit df6cd72

Browse files
committed
change build enviroment to be manylinux2014 compatible
Set up symlink for devtoolset-8 Combine Docker GCR presubmits and also push main to gcr Commit missed files Log in to GCR Fix conditional, hopefully Clarify Add Python 3.10 support (#58) Adds Python 3.10 support to the containers. Python 3.10 changes some library behavior and, for now, needs an alternative installation method to work. Upgrade gcrpio for fast build and cleanup setup Add utilities for running release tests (#56) This adds the dependencies and notably bazelrc config options to run TensorFlow's Nightly and Release tests, which I've been working on replicating on internal CI. I still have documentation and migration work to do, but the major portion of the support work is here. add gdb to the system packages change to gcc 8.3.1 from centos7 for devtoolset8 fix libstdc++ symlink in devtoolset-8 environment Undo ignoring other xml files Update README Deduplicate repeated messages Squash long runfiles paths Lock nvidia driver to 460 libtensorflow work Fix libtensorflow script and start prelim check Update Test Requirements to have same versions as tf_sig_build_dockerfiles/devel.requirements.txt (#65) * Add additional gitignore files * Update requirements with same versions Keep versions consistent with tf_sig_build_dockerfiles/devel.requirements.txt Cleanup Fix Build issue from `python_include` (#67) * Remove Python 3.10 pip special handling * Link usr/include to usr/local/include * Update location of python include * Update setup.python.sh Assorted changes -- see details - Remove installation of nvidia-profiler, which depends on libcuda1, which ultimately installs an nvidia driver package, which we don't want because we're running in docker, in which the drivers are mounted. I hope nvidia-profiler isn't necessary for anything important; otherwise we'll need to synchronize driver versions between the containers and VM images. - Add less, colordiff and a newer version of clang-format - Add code_check_changed_files, which is intended to replace the "incremental" parts of ci_sanity. Still a work in progress because we need to decide on valuable configurations (clang-format and pylint cannot be run the same way as we have them configured internally and currently have a lot of findings) - Add code_check_full, which is intended to replace the "across entire code base" parts of ci_sanity. I rewrote many of the clunkier tests. Still a work in progress because we must verify that the changed tests will still fail. - Fix bad "bazel test " expansion for libtensorflow - Fix bad chmod for libtensoflow repacker Change libtensorflow config values to fix target selection Fix a typo in venv installation (Thanks to reedwm) Remove extra lines (Thanks again to reedwm) Clarify ctrl-s warning Correctly remove extra test filters Make it possible to run isolated pip tests More work on code checks Fix a typo Clean up code check full Remove clang-format Cleanup changed_files and move one to full Add a missing test Clean up and fix code_check_full Update docs and create experimental RBE configs Update docs and create experimental RBE configs Update dependencies to 2.9.0.dev Update Go API installation guide for TensorFlow 2.8.0 (#74) Clarify usage of nightly commit Fix mistaken 'test' command Update docs and create experimental RBE configs Update docs and create experimental RBE configs Update dependencies to 2.9.0.dev Update Go API installation guide for TensorFlow 2.8.0 (#74) Clarify usage of nightly commit Fix mistaken 'test' command change to devtoolset-9 and gcc 9.3.1 for manylinux2014
1 parent 883b3b8 commit df6cd72

25 files changed

+1174
-191
lines changed

.github/workflows/docker-gcr.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.
Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,65 @@
1-
# Run on pull requests.
2-
# Builds Docker images but doesn't push them anywhere.
3-
name: Docker presubmit
1+
name: Docker Presubmit
42

53
on:
6-
# Allow manual testing on side braches
7-
workflow_dispatch:
84
pull_request:
5+
types: [labeled, opened, synchronize, reopened]
96
paths:
7+
- '.github/workflows/docker-gcr.yml'
108
- 'tf_sig_build_dockerfiles/**'
119
- '!tf_sig_build_dockerfiles/README.md'
12-
branches:
13-
- master
1410

1511
jobs:
1612
docker:
1713
runs-on: ubuntu-latest
1814
strategy:
1915
matrix:
20-
python-version: [python3.7, python3.8, python3.9]
16+
python-version: [python3.7, python3.8, python3.9, python3.10]
2117
steps:
2218
-
23-
name: Checkout this repository
19+
name: Checkout
2420
uses: actions/checkout@v2
25-
-
26-
name: Set up QEMU
27-
uses: docker/setup-qemu-action@v1
2821
-
2922
name: Set up Docker Buildx
3023
uses: docker/setup-buildx-action@v1
3124
-
32-
name: Build containers
25+
name: Login to GCR
26+
if: contains(github.event.pull_request.labels.*.name, 'build and push to gcr.io for staging')
27+
uses: docker/login-action@v1
28+
with:
29+
registry: gcr.io
30+
username: _json_key
31+
password: ${{ secrets.GCP_CREDS }}
32+
-
33+
name: Build containers, and push to GCR only if the 'build and push to gcr.io for staging' label is applied
3334
id: docker_build
3435
uses: docker/build-push-action@v2
3536
with:
36-
push: false
37+
push: ${{ contains(github.event.pull_request.labels.*.name, 'build and push to gcr.io for staging') }}
3738
context: ./tf_sig_build_dockerfiles
3839
target: devel
3940
build-args: |
4041
PYTHON_VERSION=${{ matrix.python-version }}
41-
tags: tensorflow/build:latest-${{ matrix.python-version }}
42-
cache-from: type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}
42+
tags: |
43+
gcr.io/tensorflow-sigs/build:${{ github.event.number }}-${{ matrix.python-version }}
44+
cache-from: |
45+
type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}
46+
type=registry,ref=gcr.io/tensorflow-sigs/build:${{ github.event.number }}-${{ matrix.python-version }}
4347
cache-to: type=inline
44-
48+
-
49+
name: Add a comment with the pushed containers
50+
uses: mshick/add-pr-comment@v1
51+
if: contains(github.event.pull_request.labels.*.name, 'build and push to gcr.io for staging')
52+
with:
53+
repo-token: ${{ secrets.GITHUB_TOKEN }}
54+
message: |
55+
I pushed these containers:
56+
57+
- `gcr.io/tensorflow-sigs/build:${{ github.event.number }}-python3.10`
58+
- `gcr.io/tensorflow-sigs/build:${{ github.event.number }}-python3.9`
59+
- `gcr.io/tensorflow-sigs/build:${{ github.event.number }}-python3.8`
60+
- `gcr.io/tensorflow-sigs/build:${{ github.event.number }}-python3.7`
61+
62+
Re-apply the `build and push to gcr.io for staging` label to rebuild and push again. This comment will only be posted once.
63+
-
64+
name: Print image digest
65+
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/docker.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [python3.7, python3.8, python3.9]
18+
python-version: [python3.7, python3.8, python3.9, python3.10]
1919
steps:
2020
-
2121
name: Checkout
2222
uses: actions/checkout@v2
23-
-
24-
name: Set up QEMU
25-
uses: docker/setup-qemu-action@v1
2623
-
2724
name: Set up Docker Buildx
2825
uses: docker/setup-buildx-action@v1
@@ -32,6 +29,13 @@ jobs:
3229
with:
3330
username: ${{ secrets.DOCKERHUB_USERNAME }}
3431
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
-
33+
name: Login to GCR
34+
uses: docker/login-action@v1
35+
with:
36+
registry: gcr.io
37+
username: _json_key
38+
password: ${{ secrets.GCP_CREDS }}
3539
-
3640
name: Checkout TensorFlow to get the current version
3741
uses: actions/checkout@v2
@@ -60,6 +64,8 @@ jobs:
6064
tags: |
6165
tensorflow/build:latest-${{ matrix.python-version }}
6266
tensorflow/build:${{ steps.tf-version.outputs.TF_VERSION }}-${{ matrix.python-version }}
67+
gcr.io/tensorflow-sigs/build:latest-${{ matrix.python-version }}
68+
gcr.io/tensorflow-sigs/build:${{ steps.tf-version.outputs.TF_VERSION }}-${{ matrix.python-version }}
6369
cache-from: type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}
6470
cache-to: type=inline
6571
-

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
.*.swp
22
*~
3+
.vscode/
4+
.idea/**
5+
.DS_Store
36

47
__pycache__
58
*.pyo

golang_install_guide/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ library is required for use of the TensorFlow Go package at runtime. For example
3636
on Linux (64-bit, x86):
3737

3838
```sh
39-
$ curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz | tar xz --directory /usr/local
39+
$ curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz | tar xz --directory /usr/local
4040
$ ldconfig
4141
```
4242

@@ -74,7 +74,7 @@ Instead, follow these instructions.***
7474
workspace for `/go` in the command below.
7575

7676
```sh
77-
$ git clone --branch v2.7.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
77+
$ git clone --branch v2.8.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow
7878
```
7979

8080
- Change the working directory to the base of the cloned TensorFlow repository,
@@ -85,10 +85,10 @@ Instead, follow these instructions.***
8585
$ cd /go/src/github.com/tensorflow/tensorflow
8686
```
8787

88-
- Apply a set of required patches to the TensorFlow source code.
88+
- Apply a required patch to the TensorFlow source code.
8989

9090
```sh
91-
$ git cherry-pick --strategy-option=no-renames --no-commit 41bfbe8 74bf9d1 a33fba8 aa700a8 b451698 f6a59d6
91+
$ git cherry-pick --strategy-option=no-renames --no-commit 65a5434
9292
```
9393

9494
- Initialize a new go.mod file.
@@ -127,7 +127,7 @@ workspace for `/go` in the command below:
127127

128128
```sh
129129
$ go mod init hello-world
130-
$ go mod edit -require github.com/tensorflow/tensorflow@v2.7.0+incompatible
130+
$ go mod edit -require github.com/tensorflow/tensorflow@v2.8.0+incompatible
131131
$ go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow
132132
$ go mod tidy
133133
```
@@ -173,7 +173,7 @@ func main() {
173173

174174
```sh
175175
$ go mod init app
176-
$ go mod edit -require github.com/tensorflow/tensorflow@v2.7.0+incompatible
176+
$ go mod edit -require github.com/tensorflow/tensorflow@v2.8.0+incompatible
177177
$ go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow
178178
$ go mod tidy
179179
```

golang_install_guide/example-program/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
FROM golang:1.17-bullseye
1818

19-
# 1. Install the TensorFlow C Library (v2.7.0).
20-
RUN curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-$(uname -m)-2.7.0.tar.gz \
19+
# 1. Install the TensorFlow C Library (v2.8.0).
20+
RUN curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-$(uname -m)-2.8.0.tar.gz \
2121
| tar xz --directory /usr/local \
2222
&& ldconfig
2323

@@ -27,20 +27,19 @@ RUN apt-get update && apt-get -y install --no-install-recommends \
2727
protobuf-compiler
2828

2929
# 3. Install and Setup the TensorFlow Go API.
30-
RUN git clone --branch=v2.7.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow \
30+
RUN git clone --branch=v2.8.0 https://github.com/tensorflow/tensorflow.git /go/src/github.com/tensorflow/tensorflow \
3131
&& cd /go/src/github.com/tensorflow/tensorflow \
32-
&& git cherry-pick --strategy-option=no-renames --no-commit 41bfbe8 74bf9d1 a33fba8 aa700a8 b451698 f6a59d6 \
32+
&& git cherry-pick --strategy-option=no-renames --no-commit 65a5434 \
3333
&& go mod init github.com/tensorflow/tensorflow \
3434
&& (cd tensorflow/go/op && go generate) \
3535
&& go mod tidy \
3636
&& go test ./...
3737

38-
3938
# Build the Example Program.
4039
WORKDIR /example-program
4140
COPY hello_tf.go .
4241
RUN go mod init app \
43-
&& go mod edit -require github.com/tensorflow/tensorflow@v2.7.0+incompatible \
42+
&& go mod edit -require github.com/tensorflow/tensorflow@v2.8.0+incompatible \
4443
&& go mod edit -replace github.com/tensorflow/tensorflow=/go/src/github.com/tensorflow/tensorflow \
4544
&& go mod tidy \
4645
&& go build

tf_sig_build_dockerfiles/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@ COPY setup.packages.sh setup.packages.sh
77
COPY builder.packages.txt builder.packages.txt
88
RUN /setup.packages.sh /builder.packages.txt
99

10-
# Install devtoolset-7 in /dt7 with gclibc 2.12 and libstdc++ 4.4, for building
10+
# Install devtoolset-7 in /dt7 with glibc 2.12 and libstdc++ 4.4, for building
1111
# manylinux2010-compatible packages. Scripts expect to be in the root directory.
1212
COPY builder.devtoolset/fixlinks.sh /fixlinks.sh
1313
COPY builder.devtoolset/rpm-patch.sh /rpm-patch.sh
1414
COPY builder.devtoolset/build_devtoolset.sh /build_devtoolset.sh
1515
RUN /build_devtoolset.sh devtoolset-7 /dt7
1616

17+
# Install devtoolset-9 in /dt9 with glibc 2.17 and libstdc++ 4.8, for building
18+
# manylinux2014-compatible packages.
19+
RUN /build_devtoolset.sh devtoolset-9 /dt9
20+
1721
################################################################################
18-
FROM nvidia/cuda:11.2.1-base-ubuntu20.04 as devel
22+
FROM nvidia/cuda:11.2.2-base-ubuntu20.04 as devel
1923
################################################################################
2024

2125
COPY --from=builder /dt7 /dt7
26+
COPY --from=builder /dt9 /dt9
2227

2328
# Install required development packages but delete unneeded CUDA bloat
2429
# CUDA must be cleaned up in the same command to prevent Docker layer bloating
@@ -33,10 +38,13 @@ RUN /setup.sources.sh && /setup.packages.sh /devel.packages.txt && /setup.cuda.s
3338
# - bazelisk: always use the correct bazel version
3439
# - buildifier: clean bazel build deps
3540
# - buildozer: clean bazel build deps
36-
RUN git clone --branch v1.3.0 https://github.com/bats-core/bats-core.git && bats-core/install.sh /usr/local && rm -rf bats-core
41+
RUN git clone --branch v1.5.0 https://github.com/bats-core/bats-core.git && bats-core/install.sh /usr/local && rm -rf bats-core
3742
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -O /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel
3843
RUN wget https://github.com/bazelbuild/buildtools/releases/download/3.5.0/buildifier -O /usr/local/bin/buildifier && chmod +x /usr/local/bin/buildifier
3944
RUN wget https://github.com/bazelbuild/buildtools/releases/download/3.5.0/buildozer -O /usr/local/bin/buildozer && chmod +x /usr/local/bin/buildozer
45+
RUN curl -sSL https://sdk.cloud.google.com > /tmp/gcl && bash /tmp/gcl --install-dir=~/usr/local/bin --disable-prompts
46+
# RUN wget https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz -O /clang.tar.xz && tar xf /clang.tar.xz clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-format && mv ./clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04/bin/clang-format /usr/local/bin/clang-format && rm -rf ./clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu.tar.xz ./clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu
47+
4048

4149
# Setup Python environment. PYTHON_VERSION is e.g. "python3.8"
4250
ARG PYTHON_VERSION

0 commit comments

Comments
 (0)