docker: multiarch images (amd64/aarch64) (#29691)
	
		
	
				
					
				
			* arch specific tags * merge multiarch script * arm64 build and merge jobs * update tag script * casual ci test * change image to 2204 * docker -v test * arch specific naming * Remove test_buildjet * build -arch images only when CURRENT_ARCH_BUILD is set * support new tags in tag_multiarch * Toggle CURRENT_ARCH_BUILD on in ci * Docker common * Fix condition * Fix path to docker_common * Add more stuff to common * Add build_arm job * composite job for building * Run checkout before build composite * add shell arg * move timeout to selfdrive_tests * TARGET ARCHITECTURE var * Support TARGET_ARCHITECTURE in workflow * Rewrite to Single build job with matrix * Remove shebang from docker_common * Attempt for fix build matrix * Remove setup arch * build matrix for docker push * Use 2vcpu for arm build * 2vcpu for docker_push too * temporarly unlock docker_push * Remove requirement for target arch when pushing * Unset target architecture in docker_push cl * fix sha tags * Rename action to compile-openpilot * move push_image line to tag_multiarch step * arch suffix for scons cache * cache_key_prefix for setup-with-retry * Re-disable docker_push on non-master * Add newlinespull/29850/head
							parent
							
								
									fb1b1f15aa
								
							
						
					
					
						commit
						1344a93a35
					
				
				 7 changed files with 138 additions and 55 deletions
			
			
		| @ -0,0 +1,27 @@ | |||||||
|  | name: 'compile openpilot' | ||||||
|  | 
 | ||||||
|  | inputs: | ||||||
|  |   cache_key_prefix: | ||||||
|  |     description: 'Prefix for caching key' | ||||||
|  |     required: false | ||||||
|  |     default: 'scons' | ||||||
|  | 
 | ||||||
|  | runs: | ||||||
|  |   using: "composite" | ||||||
|  |   steps: | ||||||
|  |     - shell: bash | ||||||
|  |       name: Build openpilot with all flags | ||||||
|  |       run: | | ||||||
|  |         ${{ env.RUN }} "scons -j$(nproc)" | ||||||
|  |         ${{ env.RUN }} "release/check-dirty.sh" | ||||||
|  |     - shell: bash | ||||||
|  |       name: Cleanup scons cache and rebuild | ||||||
|  |       run: | | ||||||
|  |           ${{ env.RUN }} "rm -rf /tmp/scons_cache/* && \ | ||||||
|  |                           scons -j$(nproc) --cache-populate" | ||||||
|  |     - name: Save scons cache | ||||||
|  |       uses: actions/cache/save@v3 | ||||||
|  |       if: github.ref == 'refs/heads/master' | ||||||
|  |       with: | ||||||
|  |         path: .ci_cache/scons_cache | ||||||
|  |         key: ${{ inputs.cache_key_prefix }}-${{ env.CACHE_COMMIT_DATE }}-${{ github.sha }} | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | if [ $1 = "base" ]; then | ||||||
|  |   export DOCKER_IMAGE=openpilot-base | ||||||
|  |   export DOCKER_FILE=Dockerfile.openpilot_base | ||||||
|  | elif [ $1 = "docs" ]; then | ||||||
|  |   export DOCKER_IMAGE=openpilot-docs | ||||||
|  |   export DOCKER_FILE=docs/docker/Dockerfile | ||||||
|  | elif [ $1 = "sim" ]; then | ||||||
|  |   export DOCKER_IMAGE=openpilot-sim | ||||||
|  |   export DOCKER_FILE=tools/sim/Dockerfile.sim | ||||||
|  | elif [ $1 = "prebuilt" ]; then | ||||||
|  |   export DOCKER_IMAGE=openpilot-prebuilt | ||||||
|  |   export DOCKER_FILE=Dockerfile.openpilot | ||||||
|  | elif [ $1 = "cl" ]; then | ||||||
|  |   export DOCKER_IMAGE=openpilot-base-cl | ||||||
|  |   export DOCKER_FILE=Dockerfile.openpilot_base_cl | ||||||
|  | else | ||||||
|  |   echo "Invalid docker build image $1" | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | export DOCKER_REGISTRY=ghcr.io/commaai | ||||||
|  | export COMMIT_SHA=$(git rev-parse HEAD) | ||||||
|  | 
 | ||||||
|  | TAG_SUFFIX=$2 | ||||||
|  | LOCAL_TAG=$DOCKER_IMAGE$TAG_SUFFIX | ||||||
|  | REMOTE_TAG=$DOCKER_REGISTRY/$LOCAL_TAG | ||||||
|  | REMOTE_SHA_TAG=$DOCKER_REGISTRY/$LOCAL_TAG:$COMMIT_SHA | ||||||
| @ -0,0 +1,25 @@ | |||||||
|  | #!/usr/bin/env bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | if [ $# -lt 2 ]; then | ||||||
|  |   echo "Usage: $0 <base|docs|sim|prebuilt|cl> <arch1> <arch2> ..." | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | SCRIPT_DIR=$(dirname "$0") | ||||||
|  | ARCHS=("${@:2}") | ||||||
|  | 
 | ||||||
|  | source $SCRIPT_DIR/docker_common.sh $1 | ||||||
|  | 
 | ||||||
|  | MANIFEST_AMENDS="" | ||||||
|  | for ARCH in ${ARCHS[@]}; do | ||||||
|  |   MANIFEST_AMENDS="$MANIFEST_AMENDS --amend $REMOTE_TAG-$ARCH:$COMMIT_SHA" | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | docker manifest create $REMOTE_TAG $MANIFEST_AMENDS | ||||||
|  | docker manifest create $REMOTE_SHA_TAG $MANIFEST_AMENDS | ||||||
|  | 
 | ||||||
|  | if [[ -n "$PUSH_IMAGE" ]]; then | ||||||
|  |   docker manifest push $REMOTE_TAG | ||||||
|  |   docker manifest push $REMOTE_SHA_TAG | ||||||
|  | fi | ||||||
					Loading…
					
					
				
		Reference in new issue