-
Notifications
You must be signed in to change notification settings - Fork 290
/
Copy pathgoogle-cloud-sdk.yaml
96 lines (79 loc) · 3.37 KB
/
google-cloud-sdk.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package:
name: google-cloud-sdk
version: 460.0.0
epoch: 1
description: "Google Cloud Command Line Interface"
copyright:
- license: Apache-2.0
dependencies:
runtime:
# Required for cyclic redunancy check (gsutil help crcmod)
- py3-crcmod
- python-3.12
environment:
contents:
packages:
- bash
- build-base
- busybox
- ca-certificates-bundle
- python-3.12
- python-3.12-dev
- wolfi-base
pipeline:
- runs: |
# This step is just here to make it easier to grab SHAs of the files, for adding to the steps below.
echo "SHA256 of google-cloud-sdk-${{package.version}}-linux-x86_64.tar.gz"
curl -sL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${{package.version}}-linux-x86_64.tar.gz | sha256sum -
echo "SHA256 of google-cloud-sdk-${{package.version}}-linux-arm.tar.gz"
curl -sL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${{package.version}}-linux-arm.tar.gz | sha256sum -
- if: ${{build.arch}} == "x86_64"
uses: fetch
with:
uri: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${{package.version}}-linux-x86_64.tar.gz
expected-sha256: 93684d9df236ea1207dcf8622eb7f6e4c368777b99b0c77ac848b47a0e5d9c9e
strip-components: 0
- if: ${{build.arch}} == "aarch64"
uses: fetch
with:
uri: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${{package.version}}-linux-arm.tar.gz
expected-sha256: 9a6f4f44658ad8f21555b6d51c72400a55adaefa61caadaf5b5f5a1bbe3d485b
strip-components: 0
- runs: |
./google-cloud-sdk/install.sh -q
mkdir -p ${{targets.destdir}}/usr/share/
# Trim some extra stuff
rm -rf google-cloud-sdk/platform/bundledpythonunix/
rm -rf google-cloud-sdk/deb
rm -rf google-cloud-sdk/rpm
rm google-cloud-sdk/install.bat
rm google-cloud-sdk/data/cli/gcloud.json
# Remove any third party tests that bloat up the package
find google-cloud-sdk -type d \( -name 'tests' -o -name 'test' \) -path '*/third_party/*' -exec rm -rf {} +
# This is a large binary with vulnerabilities in it, users can add it back later.
google-cloud-sdk/bin/gcloud components remove anthoscli
# This is a large binary with vulnerabilities in it, users can add it back later.
google-cloud-sdk/bin/gcloud components remove gcloud-crc32c
# Running gcloud adds a bunch of pyc files, remove those
find google-cloud-sdk/ -name "*.pyc" -exec rm -rf '{}' +
rm -rf google-cloud-sdk/.install
# gcloud expects to find a directory called ".install" in its "Installation Root" (as reported by "gcloud info").
# Without this, "gcloud components" doesn't work.
mkdir google-cloud-sdk/.install
mv google-cloud-sdk ${{targets.destdir}}/usr/share/
mkdir -p ${{targets.destdir}}/usr/bin
for f in anthoscli bq docker-credential-gcloud gcloud gcloud-crc32c git-credential-gcloud.sh gsutil java_dev_appserver.sh; do
ln -sf /usr/share/google-cloud-sdk/bin/$f ${{targets.destdir}}/usr/bin/$f
done
- uses: strip
test:
pipeline:
- runs: gcloud --version
- runs: gsutil --version
- runs: gcloud components list
update:
enabled: true
github:
identifier: GoogleCloudPlatform/cloud-sdk-docker
strip-prefix: v
use-tag: true