mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2024-11-28 18:33:16 +01:00
Merge branch 'feature/KASM-3718-gate-images-2' into 'develop'
Resolve KASM-3718 "Feature/ gate images 2" Closes KASM-3718 See merge request kasm-technologies/internal/workspaces-core-images!129
This commit is contained in:
commit
cd0324daf5
1712
.gitlab-ci.yml
1712
.gitlab-ci.yml
File diff suppressed because it is too large
Load Diff
18
ci-scripts/build.sh
Executable file
18
ci-scripts/build.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Parse input ##
|
||||
NAME1=$(echo $1| awk -F'|' '{print $1}')
|
||||
NAME2=$(echo $1| awk -F'|' '{print $2}')
|
||||
BASE=$(echo $1| awk -F'|' '{print $3}')
|
||||
BG=$(echo $1| awk -F'|' '{print $4}')
|
||||
DISTRO=$(echo $1| awk -F'|' '{print $5}')
|
||||
DOCKERFILE=$(echo $1| awk -F'|' '{print $6}')
|
||||
|
||||
## Build/Push image to cache endpoint by pipeline ID ##
|
||||
docker build \
|
||||
-t ${ORG_NAME}/image-cache-private:$(arch)-core-${NAME1}-${NAME2}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID} \
|
||||
--build-arg BASE_IMAGE="${BASE}" \
|
||||
--build-arg DISTRO="${DISTRO}" \
|
||||
--build-arg BG_IMG="${BG}" \
|
||||
-f ${DOCKERFILE} .
|
||||
docker push ${ORG_NAME}/image-cache-private:$(arch)-core-${NAME1}-${NAME2}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID}
|
105
ci-scripts/manifest.sh
Executable file
105
ci-scripts/manifest.sh
Executable file
@ -0,0 +1,105 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Globals
|
||||
FAILED="false"
|
||||
|
||||
# Ingest cli variables
|
||||
## Parse input ##
|
||||
NAME1=$(echo $1| awk -F'|' '{print $1}')
|
||||
NAME2=$(echo $1| awk -F'|' '{print $2}')
|
||||
TYPE=$2
|
||||
REVERT_PIPELINE_ID=$3
|
||||
IS_ROLLING=$4
|
||||
PULL_BRANCH=${SANITIZED_BRANCH}
|
||||
|
||||
# Determine if this is a private or public build
|
||||
if [[ "${CI_COMMIT_REF_NAME}" == release/* ]] || [[ "${CI_COMMIT_REF_NAME}" == "develop" ]]; then
|
||||
ENDPOINT="core-${NAME1}-${NAME2}"
|
||||
else
|
||||
ENDPOINT="core-${NAME1}-${NAME2}-private"
|
||||
fi
|
||||
|
||||
# Determine if this is a rolling build
|
||||
if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||
fi
|
||||
|
||||
# Determine if we are doing a reversion
|
||||
if [ ! -z "${REVERT_PIPELINE_ID}" ]; then
|
||||
# If we are reverting modify the pipeline ID to the one passed
|
||||
CI_PIPELINE_ID=${REVERT_PIPELINE_ID}
|
||||
if [ "${IS_ROLLING}" == "true" ]; then
|
||||
SANITIZED_BRANCH=${SANITIZED_BRANCH}-rolling
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check test output
|
||||
if [ -z "${REVERT_PIPELINE_ID}" ]; then
|
||||
apk add curl
|
||||
if [ "${TYPE}" == "multi" ]; then
|
||||
ARCHES=("x86_64" "aarch64")
|
||||
else
|
||||
ARCHES=("x86_64")
|
||||
fi
|
||||
for ARCH in "${ARCHES[@]}"; do
|
||||
|
||||
# Determine test status
|
||||
STATUS=$(curl -sL https://kasm-ci.s3.amazonaws.com/${CI_COMMIT_SHA}/${ARCH}/kasmweb/image-cache-private/${ARCH}-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}/ci-status.yml | awk -F'"' '{print $2}')
|
||||
if [ "${STATUS}" == "PASS" ]; then
|
||||
STATE=success
|
||||
else
|
||||
STATE=failed
|
||||
FAILED="true"
|
||||
fi
|
||||
|
||||
# Ping gitlab api with link output
|
||||
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=${STATE}&name=core-${NAME1}-${NAME2}_${ARCH}&target_url=https://kasm-ci.s3.amazonaws.com/${CI_COMMIT_SHA}/${ARCH}/kasmweb/image-cache-private/${ARCH}-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}/index.html"
|
||||
|
||||
done
|
||||
fi
|
||||
|
||||
# Fail job and go no further if tests did not pass
|
||||
if [ "${FAILED}" == "true" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Manifest for multi pull and push for single arch
|
||||
if [ "${TYPE}" == "multi" ]; then
|
||||
|
||||
# Pull images from cache repo
|
||||
docker pull ${ORG_NAME}/image-cache-private:x86_64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}
|
||||
docker pull ${ORG_NAME}/image-cache-private:aarch64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}
|
||||
|
||||
# Tag images to live repo
|
||||
docker tag \
|
||||
${ORG_NAME}/image-cache-private:x86_64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID} \
|
||||
${ORG_NAME}/${ENDPOINT}:x86_64-${SANITIZED_BRANCH}
|
||||
docker tag \
|
||||
${ORG_NAME}/image-cache-private:aarch64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID} \
|
||||
${ORG_NAME}/${ENDPOINT}:aarch64-${SANITIZED_BRANCH}
|
||||
|
||||
# Push arches to live repo
|
||||
docker push ${ORG_NAME}/${ENDPOINT}:x86_64-${SANITIZED_BRANCH}
|
||||
docker push ${ORG_NAME}/${ENDPOINT}:aarch64-${SANITIZED_BRANCH}
|
||||
|
||||
# Manifest to meta tag
|
||||
docker manifest push --purge ${ORG_NAME}/${ENDPOINT}:${SANITIZED_BRANCH} || :
|
||||
docker manifest create ${ORG_NAME}/${ENDPOINT}:${SANITIZED_BRANCH} ${ORG_NAME}/${ENDPOINT}:x86_64-${SANITIZED_BRANCH} ${ORG_NAME}/${ENDPOINT}:aarch64-${SANITIZED_BRANCH}
|
||||
docker manifest annotate ${ORG_NAME}/${ENDPOINT}:${SANITIZED_BRANCH} ${ORG_NAME}/${ENDPOINT}:aarch64-${SANITIZED_BRANCH} --os linux --arch arm64 --variant v8
|
||||
docker manifest push --purge ${ORG_NAME}/${ENDPOINT}:${SANITIZED_BRANCH}
|
||||
|
||||
# Single arch image just pull and push
|
||||
else
|
||||
|
||||
# Pull image
|
||||
docker pull ${ORG_NAME}/image-cache-private:x86_64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID}
|
||||
|
||||
# Tage image
|
||||
docker tag \
|
||||
${ORG_NAME}/image-cache-private:x86_64-core-${NAME1}-${NAME2}-${PULL_BRANCH}-${CI_PIPELINE_ID} \
|
||||
${ORG_NAME}/${ENDPOINT}:${SANITIZED_BRANCH}
|
||||
|
||||
# Push image
|
||||
docker push ${ORG_NAME}/${ENDPOINT}:${SANITIZED_BRANCH}
|
||||
|
||||
fi
|
13
ci-scripts/readme.sh
Executable file
13
ci-scripts/readme.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#! /bin/bash
|
||||
|
||||
## Parse input ##
|
||||
NAME1=$(echo $1| awk -F'|' '{print $1}')
|
||||
NAME2=$(echo $1| awk -F'|' '{print $2}')
|
||||
|
||||
## Run readme updater ##
|
||||
docker run -v $PWD/docs:/docs \
|
||||
-e RELEASE="$KASM_RELEASE" \
|
||||
-e DOCKER_USERNAME="$README_USERNAME" \
|
||||
-e DOCKER_PASSWORD="$README_PASSWORD" \
|
||||
-e DOCKERHUB_REPOSITORY="${ORG_NAME}/core-${NAME1}-${NAME2}" \
|
||||
kasmweb/dockerhub-updater:develop
|
226
ci-scripts/test.sh
Executable file
226
ci-scripts/test.sh
Executable file
@ -0,0 +1,226 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
## Parse input ##
|
||||
NAME1=$(echo $1| awk -F'|' '{print $1}')
|
||||
NAME2=$(echo $1| awk -F'|' '{print $2}')
|
||||
BASE=$(echo $1| awk -F'|' '{print $3}')
|
||||
BG=$(echo $1| awk -F'|' '{print $4}')
|
||||
DISTRO=$(echo $1| awk -F'|' '{print $5}')
|
||||
DOCKERFILE=$(echo $1| awk -F'|' '{print $6}')
|
||||
ARCH=$2
|
||||
AWS_ID=$3
|
||||
AWS_KEY=$4
|
||||
|
||||
# Setup aws cli
|
||||
export AWS_ACCESS_KEY_ID="${AWS_ID}"
|
||||
export AWS_SECRET_ACCESS_KEY="${AWS_KEY}"
|
||||
export AWS_DEFAULT_REGION=us-east-1
|
||||
|
||||
# Install tools for testing
|
||||
apk add \
|
||||
aws-cli \
|
||||
curl \
|
||||
jq \
|
||||
openssh-client
|
||||
|
||||
## Functions ##
|
||||
# Ami locater
|
||||
getami () {
|
||||
aws ec2 describe-images --filters \
|
||||
"Name=name,Values=$1*" \
|
||||
"Name=owner-id,Values=$2" \
|
||||
"Name=state,Values=available" \
|
||||
"Name=architecture,Values=$3" \
|
||||
"Name=virtualization-type,Values=hvm" \
|
||||
"Name=root-device-type,Values=ebs" \
|
||||
"Name=image-type,Values=machine" \
|
||||
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
|
||||
--output 'text' \
|
||||
--region us-east-1
|
||||
}
|
||||
# Make sure deployment is ready
|
||||
function ready_check() {
|
||||
while :; do
|
||||
sleep 2
|
||||
CHECK=$(curl --max-time 5 -sLk https://${IPS[0]}/api/__healthcheck || :)
|
||||
if [[ "${CHECK}" =~ .*"true".* ]]; then
|
||||
echo "Workspaces at "${IPS[0]}" ready for testing"
|
||||
break
|
||||
else
|
||||
echo "Waiting for Workspaces at "${IPS[0]}" to be ready"
|
||||
fi
|
||||
done
|
||||
sleep 30
|
||||
}
|
||||
|
||||
# Determine deployment based on arch
|
||||
if [[ "${ARCH}" == "x86_64" ]]; then
|
||||
AMI=$(getami "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04" 099720109477 x86_64)
|
||||
TYPE=c5.large
|
||||
USER=ubuntu
|
||||
else
|
||||
AMI=$(getami "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04" 099720109477 arm64)
|
||||
TYPE=c6g.large
|
||||
USER=ubuntu
|
||||
fi
|
||||
|
||||
# Setup SSH Key
|
||||
mkdir -p /root/.ssh
|
||||
RAND=$(head /dev/urandom | tr -dc 'a-z0-9' | head -c36)
|
||||
SSH_KEY=$(aws ec2 create-key-pair --key-name ${RAND} | jq -r '.KeyMaterial')
|
||||
cat >/root/.ssh/id_rsa <<EOL
|
||||
$SSH_KEY
|
||||
EOL
|
||||
chmod 600 /root/.ssh/id_rsa
|
||||
|
||||
# Launch instance
|
||||
cat >/root/user-data <<EOL
|
||||
#!/bin/bash
|
||||
shutdown -P +60
|
||||
EOL
|
||||
aws ec2 run-instances \
|
||||
--image-id ${AMI} \
|
||||
--count 1 \
|
||||
--tag-specifications 'ResourceType=instance,Tags=[{Key=gitlab-os-integration,Value=true}]' \
|
||||
--instance-type ${TYPE} \
|
||||
--key-name ${RAND} \
|
||||
--security-group-ids sg-029d5bc88b001fbe5 \
|
||||
--subnet-id subnet-0ee70521f1f979f5f \
|
||||
--associate-public-ip-address \
|
||||
--user-data file:///root/user-data \
|
||||
--block-device-mapping '[ { "DeviceName": "/dev/sda1", "Ebs": { "VolumeSize": 120 } } ]' \
|
||||
--instance-initiated-shutdown-behavior terminate > /tmp/instance.json
|
||||
INSTANCE=$(cat /tmp/instance.json | jq -r " .Instances[0].InstanceId")
|
||||
INSTANCES+=("${INSTANCE}")
|
||||
for INSTANCE_ID in "${INSTANCES[@]}"; do
|
||||
echo $INSTANCE_ID
|
||||
done
|
||||
|
||||
# Determine IPs of instances
|
||||
IPS=()
|
||||
for INSTANCE_ID in "${INSTANCES[@]}"; do
|
||||
while :; do
|
||||
sleep 2
|
||||
IP=$(aws ec2 describe-instances \
|
||||
--instance-id ${INSTANCE_ID} \
|
||||
| jq -r '.Reservations[0].Instances[0].PublicIpAddress')
|
||||
if [ "${IP}" == 'null' ]; then
|
||||
echo "Waiting for Pub IP from instance ${INSTANCE_ID}"
|
||||
else
|
||||
echo "Instance ${INSTANCE_ID} IP=${IP}"
|
||||
IPS+=("${IP}")
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Shutdown Instances function and trap
|
||||
function turnoff() {
|
||||
for IP in "${IPS[@]}"; do
|
||||
ssh \
|
||||
-oConnectTimeout=4 \
|
||||
-oStrictHostKeyChecking=no \
|
||||
${USER}@${IP} \
|
||||
"sudo poweroff" || :
|
||||
done
|
||||
aws ec2 delete-key-pair --key-name ${RAND}
|
||||
}
|
||||
trap turnoff ERR
|
||||
|
||||
# Make sure the instance is up
|
||||
for IP in "${IPS[@]}"; do
|
||||
while :; do
|
||||
sleep 2
|
||||
UPTIME=$(ssh \
|
||||
-oConnectTimeout=4 \
|
||||
-oStrictHostKeyChecking=no \
|
||||
${USER}@${IP} \
|
||||
'uptime'|| :)
|
||||
if [ -z "${UPTIME}" ]; then
|
||||
echo "Waiting for ${IP} to be up"
|
||||
else
|
||||
echo "${IP} up ${UPTIME}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Sleep here to ensure subsequent connections don't fail
|
||||
sleep 30
|
||||
|
||||
# Double check we are up
|
||||
for IP in "${IPS[@]}"; do
|
||||
while :; do
|
||||
sleep 2
|
||||
UPTIME=$(ssh \
|
||||
-oConnectTimeout=4 \
|
||||
-oStrictHostKeyChecking=no \
|
||||
${USER}@${IP} \
|
||||
'uptime'|| :)
|
||||
if [ -z "${UPTIME}" ]; then
|
||||
echo "Waiting for ${IP} to be up"
|
||||
else
|
||||
echo "${IP} up ${UPTIME}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Copy over docker auth
|
||||
for IP in "${IPS[@]}"; do
|
||||
scp \
|
||||
-oStrictHostKeyChecking=no \
|
||||
/root/.docker/config.json \
|
||||
${USER}@${IP}:/tmp/
|
||||
ssh \
|
||||
-oConnectTimeout=10 \
|
||||
-oStrictHostKeyChecking=no \
|
||||
${USER}@${IP} \
|
||||
"sudo mkdir -p /root/.docker && sudo mv /tmp/config.json /root/.docker/ && sudo chown root:root /root/.docker/config.json"
|
||||
done
|
||||
|
||||
# Install Kasm workspaces
|
||||
ssh \
|
||||
-oConnectTimeout=4 \
|
||||
-oStrictHostKeyChecking=no \
|
||||
${USER}@"${IPS[0]}" \
|
||||
"curl -L -o /tmp/installer.tar.gz ${TEST_INSTALLER} && cd /tmp && tar xf installer.tar.gz && sudo bash kasm_release/install.sh -H -u -I -e -P ${RAND} -U ${RAND}"
|
||||
|
||||
# Ensure install is up and running
|
||||
ready_check
|
||||
|
||||
# Pull tester image
|
||||
docker pull ${ORG_NAME}/kasm-tester:1.14.0
|
||||
|
||||
# Run test
|
||||
cp /root/.ssh/id_rsa $(dirname ${CI_PROJECT_DIR})/sshkey
|
||||
chmod 777 $(dirname ${CI_PROJECT_DIR})/sshkey
|
||||
docker pull kasmweb/kasm-tester:1.14.0
|
||||
docker run --rm \
|
||||
-e TZ=US/Pacific \
|
||||
-e KASM_HOST=${IPS[0]} \
|
||||
-e KASM_PORT=443 \
|
||||
-e KASM_PASSWORD="${RAND}" \
|
||||
-e SSH_USER=$USER \
|
||||
-e DOCKERUSER=$DOCKER_HUB_USERNAME \
|
||||
-e DOCKERPASS=$DOCKER_HUB_PASSWORD \
|
||||
-e TEST_IMAGE="${ORG_NAME}/image-cache-private:${ARCH}-core-${NAME1}-${NAME2}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID}" \
|
||||
-e AWS_KEY=${KASM_TEST_AWS_KEY} \
|
||||
-e AWS_SECRET="${KASM_TEST_AWS_SECRET}" \
|
||||
-e SLACK_TOKEN=${SLACK_TOKEN} \
|
||||
-e S3_BUCKET=kasm-ci \
|
||||
-e COMMIT=${CI_COMMIT_SHA} \
|
||||
-e REPO=workspaces-core-images \
|
||||
-e AUTOMATED=true \
|
||||
-v $(dirname ${CI_PROJECT_DIR})/sshkey:/sshkey:ro ${SLIM_FLAG} \
|
||||
kasmweb/kasm-tester:1.14.0
|
||||
|
||||
# Shutdown Instances
|
||||
turnoff
|
||||
|
||||
# Exit 1 if test failed or file does not exist
|
||||
STATUS=$(curl -sL https://kasm-ci.s3.amazonaws.com/${CI_COMMIT_SHA}/${ARCH}/kasmweb/image-cache-private/${ARCH}-core-${NAME1}-${NAME2}-${SANITIZED_BRANCH}-${CI_PIPELINE_ID}/ci-status.yml | awk -F'"' '{print $2}')
|
||||
if [ ! "${STATUS}" == "PASS" ]; then
|
||||
exit 1
|
||||
fi
|
@ -119,6 +119,10 @@ RUN bash $INST_SCRIPTS/virtualgl/install_virtualgl.sh && rm -rf $INST_SCRIPTS/vi
|
||||
COPY ./src/ubuntu/install/sysbox $INST_SCRIPTS/sysbox/
|
||||
RUN bash $INST_SCRIPTS/sysbox/install_systemd.sh && rm -rf $INST_SCRIPTS/sysbox/
|
||||
|
||||
### Custom Folder Emblems
|
||||
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
|
||||
RUN bash $INST_SCRIPTS/emblems/install_emblems.sh && rm -rf $INST_SCRIPTS/emblems/
|
||||
|
||||
### Create user and home directory for base images that don't already define it
|
||||
RUN (groupadd -g 1000 kasm-user \
|
||||
&& useradd -M -u 1000 -g 1000 kasm-user \
|
||||
|
@ -109,6 +109,10 @@ RUN bash $STARTUPDIR/set_user_permission.sh $STARTUPDIR $HOME && \
|
||||
COPY ./src/ubuntu/install/extra $INST_SCRIPTS/extra/
|
||||
RUN bash $INST_SCRIPTS/extra/$EXTRA_SH && rm -rf $INST_SCRIPTS/extra/
|
||||
|
||||
### Custom Folder Emblems
|
||||
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
|
||||
RUN bash $INST_SCRIPTS/emblems/install_emblems.sh && rm -rf $INST_SCRIPTS/emblems/
|
||||
|
||||
### Create user and home directory for base images that don't already define it
|
||||
RUN (groupadd -g 1000 kasm-user \
|
||||
&& useradd -M -u 1000 -g 1000 kasm-user \
|
||||
|
@ -116,6 +116,10 @@ RUN bash $STARTUPDIR/set_user_permission.sh $STARTUPDIR $HOME && \
|
||||
COPY ./src/ubuntu/install/extra $INST_SCRIPTS/extra/
|
||||
RUN bash $INST_SCRIPTS/extra/$EXTRA_SH && rm -rf $INST_SCRIPTS/extra/
|
||||
|
||||
### Custom Folder Emblems
|
||||
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
|
||||
RUN bash $INST_SCRIPTS/emblems/install_emblems.sh && rm -rf $INST_SCRIPTS/emblems/
|
||||
|
||||
### Create user and home directory for base images that don't already define it
|
||||
RUN (groupadd -g 1000 kasm-user \
|
||||
&& useradd -M -u 1000 -g 1000 kasm-user \
|
||||
|
@ -124,6 +124,10 @@ RUN bash $STARTUPDIR/set_user_permission.sh $STARTUPDIR $HOME && \
|
||||
COPY ./src/ubuntu/install/extra $INST_SCRIPTS/extra/
|
||||
RUN bash $INST_SCRIPTS/extra/$EXTRA_SH && rm -rf $INST_SCRIPTS/extra/
|
||||
|
||||
### Custom Folder Emblems
|
||||
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
|
||||
RUN bash $INST_SCRIPTS/emblems/install_emblems.sh && rm -rf $INST_SCRIPTS/emblems/
|
||||
|
||||
### Create user and home directory for base images that don't already define it
|
||||
RUN (groupadd -g 1000 kasm-user \
|
||||
&& useradd -M -u 1000 -g 1000 kasm-user \
|
||||
|
@ -143,6 +143,10 @@ RUN bash $INST_SCRIPTS/extra/$EXTRA_SH && rm -rf $INST_SCRIPTS/extra/
|
||||
COPY ./src/ubuntu/install/sysbox $INST_SCRIPTS/sysbox/
|
||||
RUN bash $INST_SCRIPTS/sysbox/install_systemd.sh && rm -rf $INST_SCRIPTS/sysbox/
|
||||
|
||||
### Custom Folder Emblems
|
||||
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
|
||||
RUN bash $INST_SCRIPTS/emblems/install_emblems.sh && rm -rf $INST_SCRIPTS/emblems/
|
||||
|
||||
### Create user and home directory for base images that don't already define it
|
||||
RUN (groupadd -g 1000 kasm-user \
|
||||
&& useradd -M -u 1000 -g 1000 kasm-user \
|
||||
|
@ -118,6 +118,10 @@ RUN bash $INST_SCRIPTS/extra/$EXTRA_SH && rm -rf $INST_SCRIPTS/extra/
|
||||
COPY ./src/ubuntu/install/sysbox $INST_SCRIPTS/sysbox/
|
||||
RUN bash $INST_SCRIPTS/sysbox/install_systemd.sh && rm -rf $INST_SCRIPTS/sysbox/
|
||||
|
||||
### Custom Folder Emblems
|
||||
COPY ./src/ubuntu/install/emblems $INST_SCRIPTS/emblems/
|
||||
RUN bash $INST_SCRIPTS/emblems/install_emblems.sh && rm -rf $INST_SCRIPTS/emblems/
|
||||
|
||||
### Create user and home directory for base images that don't already define it
|
||||
RUN (groupadd -g 1000 kasm-user \
|
||||
&& useradd -M -u 1000 -g 1000 kasm-user \
|
||||
|
16
src/common/startup_scripts/emblems.sh
Executable file
16
src/common/startup_scripts/emblems.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set any bookmarks passed from env
|
||||
if [ ! -z ${CLOUD_MOUNTS+x} ]; then
|
||||
mkdir -p $HOME/.config/gtk-3.0/
|
||||
touch $HOME/.config/gtk-3.0/bookmarks
|
||||
IFS=,
|
||||
for CLOUD_MOUNT in ${CLOUD_MOUNTS}; do
|
||||
LOCAL_PATH=$(echo "${CLOUD_MOUNT}" | awk -F'|' '{print $1}')
|
||||
ICON=$(echo "${CLOUD_MOUNT}" | awk -F'|' '{print $2}')
|
||||
if [ -d "${LOCAL_PATH}" ] && ! grep -qx "file://${LOCAL_PATH}" $HOME/.config/gtk-3.0/bookmarks; then
|
||||
echo "file://${LOCAL_PATH}" >> $HOME/.config/gtk-3.0/bookmarks
|
||||
gio set -t stringv "${LOCAL_PATH}" metadata::emblems "${ICON}-emblem"
|
||||
fi
|
||||
done
|
||||
fi
|
31
src/ubuntu/install/emblems/install_emblems.sh
Normal file
31
src/ubuntu/install/emblems/install_emblems.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Icon list to ingest
|
||||
IFS=$'\n'
|
||||
icons='https://upload.wikimedia.org/wikipedia/commons/b/bc/Amazon-S3-Logo.svg|s3
|
||||
https://upload.wikimedia.org/wikipedia/commons/6/60/Nextcloud_Logo.svg|nextcloud
|
||||
https://upload.wikimedia.org/wikipedia/commons/3/3c/Microsoft_Office_OneDrive_%282019%E2%80%93present%29.svg|onedrive
|
||||
https://upload.wikimedia.org/wikipedia/commons/1/12/Google_Drive_icon_%282020%29.svg|gdrive
|
||||
https://upload.wikimedia.org/wikipedia/commons/7/78/Dropbox_Icon.svg|dropbox
|
||||
https://kasm-ci.s3.amazonaws.com/kasm.svg|kasm'
|
||||
|
||||
# Download icons and add to cache
|
||||
mkdir -p /usr/share/icons/hicolor/scalable/emblems
|
||||
for icon in $icons; do
|
||||
URL=$(echo "${icon}" | awk -F'|' '{print $1}')
|
||||
NAME=$(echo "${icon}" | awk -F'|' '{print $2}')
|
||||
curl -o /usr/share/icons/hicolor/scalable/emblems/${NAME}-emblem.svg -L "${URL}"
|
||||
echo "[Icon Data]" >> /usr/share/icons/hicolor/scalable/emblems/${NAME}-emblem.icon
|
||||
echo "DisplayName=${NAME}-emblem" >> /usr/share/icons/hicolor/scalable/emblems/${NAME}-emblem.icon
|
||||
done
|
||||
gtk-update-icon-cache -f /usr/share/icons/hicolor
|
||||
|
||||
# Support dynamic icons on init
|
||||
cat >>/etc/xdg/autostart/emblems.desktop<<EOL
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Folder Emblems
|
||||
Exec=/dockerstartup/emblems.sh
|
||||
EOL
|
||||
chmod +x /etc/xdg/autostart/emblems.desktop
|
@ -96,6 +96,7 @@ elif [[ "${DISTRO}" == @(centos|oracle7) ]]; then
|
||||
disable_epel_nss_wrapper_that_breaks_firefox
|
||||
yum groupinstall xfce -y
|
||||
yum install -y \
|
||||
gvfs \
|
||||
wmctrl \
|
||||
xclip \
|
||||
xfce4-notifyd \
|
||||
@ -104,6 +105,7 @@ elif [ "$DISTRO" = "oracle8" ]; then
|
||||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
dnf group install xfce -y
|
||||
dnf install -y \
|
||||
gvfs \
|
||||
wmctrl \
|
||||
xclip \
|
||||
xfce4-notifyd \
|
||||
@ -115,6 +117,7 @@ elif [ "$DISTRO" = "oracle9" ]; then
|
||||
dnf group install xfce -y -x oracle-backgrounds
|
||||
dnf install -y \
|
||||
dbus-x11 \
|
||||
gvfs \
|
||||
wmctrl \
|
||||
xclip \
|
||||
xfce4-notifyd \
|
||||
@ -124,6 +127,7 @@ elif [[ "$DISTRO" == @(rockylinux9|almalinux9) ]]; then
|
||||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
|
||||
dnf group install xfce -y
|
||||
dnf install -y \
|
||||
gvfs \
|
||||
dbus-x11 \
|
||||
wmctrl \
|
||||
xclip \
|
||||
@ -134,6 +138,7 @@ elif [[ "$DISTRO" == @(rockylinux8|almalinux8) ]]; then
|
||||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
dnf group install xfce -y
|
||||
dnf install -y \
|
||||
gvfs \
|
||||
dbus-x11 \
|
||||
wmctrl \
|
||||
xclip \
|
||||
@ -142,6 +147,7 @@ elif [[ "$DISTRO" == @(rockylinux8|almalinux8) ]]; then
|
||||
elif [ "$DISTRO" = "opensuse" ]; then
|
||||
zypper install -yn -t pattern xfce
|
||||
zypper install -yn \
|
||||
gvfs \
|
||||
xclip \
|
||||
xfce4-notifyd \
|
||||
xfce4-terminal \
|
||||
@ -149,6 +155,7 @@ elif [ "$DISTRO" = "opensuse" ]; then
|
||||
elif [[ "$DISTRO" = @(fedora37|fedora38) ]]; then
|
||||
dnf group install xfce -y
|
||||
dnf install -y \
|
||||
gvfs \
|
||||
wmctrl \
|
||||
xclip \
|
||||
xfce4-notifyd \
|
||||
@ -159,6 +166,7 @@ elif [ "$DISTRO" = "alpine" ]; then
|
||||
faenza-icon-theme \
|
||||
faenza-icon-theme-xfce4-appfinder \
|
||||
faenza-icon-theme-xfce4-panel \
|
||||
gvfs \
|
||||
mesa \
|
||||
mesa-dri-gallium \
|
||||
mesa-gl \
|
||||
|
Loading…
Reference in New Issue
Block a user