File tree Expand file tree Collapse file tree
taskcluster/docker/skopeo Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+ # Set pipefail so curl failures are caught before the pipe to jq
4+ set -o pipefail # This will fail on sh / only works on bash
5+
6+ test $APP
7+ test $DOCKER_TAG
8+ test $DOCKER_REPO
9+ test $MOZ_FETCHES_DIR
10+ test $TASKCLUSTER_ROOT_URL
11+ test $TASK_ID
12+ test $VCS_HEAD_REPOSITORY
13+ test $VCS_HEAD_REV
14+
15+ echo " === Generating dockercfg ==="
16+ PASSWORD_URL=http://taskcluster/secrets/v1/secret/project/releng/scriptworker-scripts/deploy
17+ mkdir -m 700 $HOME /.docker
18+ # curl --fail forces curl to return a non-zero exit code if the response isn't HTTP 200 (i.e.: HTTP 403 Unauthorized)
19+ curl --fail -v $PASSWORD_URL | jq ' .secret.gar.dockercfg' > $HOME /.docker/config.json
20+ chmod 600 $HOME /.docker/config.json
21+
22+ cd $MOZ_FETCHES_DIR
23+ unzstd image.tar.zst
24+
25+ echo " === Inserting version.json into image ==="
26+ # Create an OCI copy of image in order umoci can patch it
27+ skopeo copy docker-archive:image.tar oci:${APP} :final
28+
29+ cat > version.json << EOF
30+ {
31+ "commit": "${VCS_HEAD_REV} ",
32+ "source": "${VCS_HEAD_REPOSITORY} ",
33+ "build": "${TASKCLUSTER_ROOT_URL} /tasks/${TASK_ID} "
34+ }
35+ EOF
36+
37+ umoci insert --image ${APP} :final version.json /app/version.json
38+
39+ echo " === Pushing to docker hub ==="
40+ skopeo copy oci:${APP} :final docker://$DOCKER_REPO :$DOCKER_TAG
41+ skopeo inspect docker://$DOCKER_REPO :$DOCKER_TAG
42+
43+ echo " === Clean up ==="
44+ rm -rf $HOME /.docker
You can’t perform that action at this time.
0 commit comments