-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create additional ResourceAccess and Authentication structures and related yaml to store in the database. - The only supported driver is VMX. All other drivers need to be taught about the new Authentication struct (in the future). - Add ProxySshAddress configuration variable to fish Config, the default value is `0.0.0.0:2022`. - Add corresponding SSH examples. - **NOTE**: while `scp` succeeds, it hangs and must be ctrl+C'd. This is not getting fixed in this PR. This feature currently only supports SSH via username/password. See the new example label creation: ``` authentication: username: packer password: packer ``` When the fish node is running, you must query the application resource UID and request `/access` (see new run application example). These passwords are **one time use only**, in order to get a new password, re-request `/access`.
- Loading branch information
Showing
15 changed files
with
695 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh -e | ||
# Copyright 2024 Adobe. All rights reserved. | ||
# This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. You may obtain a copy | ||
# of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software distributed under | ||
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
# OF ANY KIND, either express or implied. See the License for the specific language | ||
# governing permissions and limitations under the License. | ||
|
||
# | ||
# This example script allows to see the existing Label and create a new version of it | ||
# Please check the images URLs in Label definitions below | ||
# | ||
|
||
token=$1 | ||
[ "$token" ] || exit 1 | ||
hostport=$2 | ||
[ "$hostport" ] || hostport=localhost:8001 | ||
|
||
label=ubuntu2004arm-ci_vmx | ||
|
||
# It's a bit dirty, but works for now - probably better to create API call to find the latest label | ||
curr_label=$(curl -s -u "admin:$token" -k "https://$hostport/api/v1/label/?filter=name=\"$label\"" | sed 's/},{/},\n{/g' | tail -1) | ||
curr_version="$(echo "$curr_label" | grep -o '"version": *[0-9]\+' | tr -dc '0-9')" | ||
echo "Current label '$label:$curr_version': $curr_label" | ||
|
||
[ "x$curr_version" != "x" ] || curr_version=0 | ||
new_version=$(($curr_version+1)) | ||
|
||
echo | ||
echo "Create the new version of Label '$label:$new_version' ?" | ||
echo "Press any key to create or Ctrl-C to abort" | ||
read w1 | ||
|
||
label_id=$(curl -s -u "admin:$token" -k -X POST -H 'Content-Type: application/yaml' -d '--- | ||
name: "'$label'" | ||
version: '$new_version' | ||
definitions: | ||
- driver: vmx | ||
options: | ||
images: # For test purposes images are used as symlink to aquarium-bait/out so does not need checksum | ||
- url: https://artifact-storage/aquarium/image/vmx/ubuntu2004arm-VERSION/ubuntu2004arm-VERSION.tar.xz | ||
- url: https://artifact-storage/aquarium/image/vmx/ubuntu2004arm-ci-VERSION/ubuntu2004arm-ci-VERSION.tar.xz | ||
resources: | ||
cpu: 4 | ||
ram: 4 | ||
authentication: | ||
username: packer | ||
password: packer | ||
' "https://$hostport/api/v1/label/" | grep -o '"UID": *"[^"]\+"' | cut -d':' -f 2 | tr -d ' "') | ||
|
||
echo "Created Label ID: ${label_id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/sh -e | ||
# Copyright 2024 Adobe. All rights reserved. | ||
# This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. You may obtain a copy | ||
# of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software distributed under | ||
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
# OF ANY KIND, either express or implied. See the License for the specific language | ||
# governing permissions and limitations under the License. | ||
|
||
# | ||
# This script creates the new Application to allocate resource of the latest version of Label | ||
# Please check the Application metadata below - it defines the jenkins node to connect | ||
# | ||
|
||
token=$1 | ||
[ "$token" ] || exit 1 | ||
hostport=$2 | ||
[ "$hostport" ] || hostport=localhost:8001 | ||
|
||
label=ubuntu2004arm-ci_vmx | ||
|
||
# It's a bit dirty, but works for now - probably better to create API call to find the latest label | ||
curr_label=$(curl -s -u "admin:$token" -k "https://$hostport/api/v1/label/?filter=name=\"$label\"" | sed 's/},{"UID":/},\n{"UID":/g' | tail -1) | ||
curr_label_id="$(echo "$curr_label" | grep -o '"UID": *"[^"]\+"' | cut -d':' -f 2 | tr -d ' "')" | ||
if [ "x$curr_label_id" = "x" ]; then | ||
echo "ERROR: Unable to find label '$label' - please create one before running the application" | ||
exit 1 | ||
fi | ||
|
||
echo "Found label '$label': $curr_label_id : $curr_label" | ||
|
||
echo | ||
echo "Press key to create the Application with label '$label'" | ||
read w1 | ||
|
||
app=$(curl -s -u "admin:$token" -k -X POST -H 'Content-Type: application/yaml' -d '--- | ||
label_UID: '$curr_label_id' | ||
metadata: | ||
JENKINS_URL: https://jenkins-host.local/ | ||
JENKINS_AGENT_SECRET: 03839eabcf945b1e780be8f9488d264c4c57bf388546da9a84588345555f29b0 | ||
JENKINS_AGENT_NAME: test-node | ||
' "https://$hostport/api/v1/application/") | ||
app_id="$(echo "$app" | grep -o '"UID": *"[^"]\+"' | cut -d':' -f 2 | tr -d ' "')" | ||
|
||
echo "Application created: $app_id : $app" | ||
|
||
echo "Press key to check the application resource" | ||
read w1 | ||
|
||
response="$(curl -s -u "admin:$token" -k "https://$hostport/api/v1/application/$app_id/resource")" | ||
resource_UID="$(echo "$response" | grep -o '"UID": *"[^"]\+"' | cut -d':' -f 2 | tr -d ' "')" | ||
echo "Application resource:" | ||
echo "$response" | ||
echo "Resource UID: $resource_UID" | ||
|
||
echo "Press key to query SSH authentication information" | ||
echo 'You will need to `ssh -p PORT [email protected]`, where PORT by default is 2022' | ||
read w1 | ||
|
||
# Passwords are one-time use, after it has been used you must re-issue this | ||
# curl command to get a new password. | ||
curl -u "admin:$token" -k "https://$hostport/api/v1/resource/$resource_UID/access" | ||
|
||
echo "Press key to deallocate the application resource" | ||
read w1 | ||
|
||
curl -u "admin:$token" -k "https://$hostport/api/v1/application/$app_id/deallocate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.