├── .gitignore
├── jetbrains
├── idt-jetbrains.png
├── idt-jetbrains-settings.jar
└── README.md
├── ISSUE_TEMPLATE
├── idt_release_notes.md
├── README.md
├── linux-installer
├── README.md
└── idt-installer
├── windows-installer
├── README.md
└── idt-win-installer.ps1
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 |
--------------------------------------------------------------------------------
/jetbrains/idt-jetbrains.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/HEAD/jetbrains/idt-jetbrains.png
--------------------------------------------------------------------------------
/jetbrains/idt-jetbrains-settings.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/HEAD/jetbrains/idt-jetbrains-settings.jar
--------------------------------------------------------------------------------
/ISSUE_TEMPLATE:
--------------------------------------------------------------------------------
1 | **Summary**
2 |
3 |
4 | **Steps to reproduce**
5 | (include tooling version, platform, etc)
6 | 1.
7 |
8 | **Operating System**
9 | Specify: (MacOS, Linux, Windows)
10 |
11 | **Supporting details**
12 | (Logs, stack traces, images, etc. Wrap in ` ... ` tags as appropriate)
13 |
14 | -----------------------------------
15 |
16 | **Development "done" checklist**
17 |
18 | - [ ] Test case to verify
19 | - [ ] Public Documentation updated
20 | - [ ] Change added to "release notes" as appropropriate
21 | - [ ] Notification to stakeholders (OM, other squads, etc)
--------------------------------------------------------------------------------
/idt_release_notes.md:
--------------------------------------------------------------------------------
1 |
2 | ## v1.1.0 Dec 13, 2017
3 | - Integrate DevOps (CF or Kube) during app creation
4 | - Use Docker Compose to Develop a Multi-Container Application
5 | - Launch a Deployed Web Application with View
6 | - Access Local Containers with Shell
7 | - Improved Create Interaction
8 | - Usability Improvements
9 | - and bug fixes
10 |
11 | You can read about this new release here: https://www.ibm.com/blogs/bluemix/2017/12/whats-included-ibm-cloud-developer-tools-cli-version-1-1-0/
12 |
13 | ## v1.0.8 Oct 26, 2017
14 | - modifies the `bx dev console` command for the new location of projects due to the app-services changes to the Public Cloud console.
15 |
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # IBM Cloud Developer Tools [DEPRECATED]
2 | [](https://cloud.ibm.com)
3 |
4 | **The IBM Cloud Developer Tools installer is no longer supported, please consider installing the IBM Cloud stand-alone client instead. See [Installing the stand-alone IBM Cloud CLI](https://cloud.ibm.com/docs/cli?topic=cli-install-ibmcloud-cli) for more information on installing the stand-alone client.**
5 |
6 | This repo provides support for the IBM Cloud Developer Tools (IDT) CLI environment. The IDT tools currently consists of the IBM Cloud CLI (ibmcloud) 'dev' and other plugins, as well as extensions to multiple IDEs.
7 |
8 | These tools work for the following environments:
9 | - [IBM **Cloud** Public](https://www.ibm.com/cloud-computing/)
10 | - [IBM **Cloud** Private](https://www.ibm.com/cloud-computing/products/ibm-cloud-private/)
11 | - [IBM **Cloud** Dedicated](https://www.ibm.com/cloud-computing/bluemix/dedicated)
12 |
13 | If you run into any issues, please let us know on the [IBM Cloud Tech Slack :: #developer-tools](https://slack-invite-ibm-cloud-tech.mybluemix.net/) or file an issue on our [GitHub repo](https://github.com/IBM-Cloud/ibm-cloud-developer-tools).
14 |
15 |
16 |
17 | ## IDT MacOS & Linux Installation
18 |
19 | The following command will install the IBM Cloud Developer Tools in a single invocation. Open up a terminal and run the following command:
20 |
21 | ```
22 | $ curl -sL https://ibm.biz/idt-installer | bash
23 | ```
24 |
25 | Once complete, there will be a shortcut defined to access the IBM Cloud CLI:
26 | - `ic` : Shortcut for the 'ibmcloud' command
27 |
28 |
29 | Access the [platform-specific readme](./linux-installer/README.md) for additional details.
30 |
31 |
32 |
33 | ## IDT Windows Installation
34 |
35 | To install the IBM Cloud Developer Tools CLI on Windows 10 or newer:
36 |
37 | 1. Open Windows PowerShell by right-clicking and select "Run as Administrator".
38 | 2. Run this command:
39 | ```
40 | Set-ExecutionPolicy Unrestricted; iex(New-Object Net.WebClient).DownloadString('https://ibm.biz/idt-win-installer')
41 | ```
42 |
43 | Access the [Windows-specific readme](./windows-installer/README.md) for additional details.
44 |
45 |
46 | ## 3rd Party IDE Extensions
47 |
48 | The following IDE extensions are available to enable access to IDT CLI directly from within the IDE.
49 |
50 | - [Visual Studio Code](https://code.visualstudio.com/) editor - [IBM Developer Tools extension](https://marketplace.visualstudio.com/items?itemName=IBM.ibm-developer)
51 | - [Jetbrains](https://www.jetbrains.com) based IDEs (IntelliJ, WebStorm, Android Studio, etc) - [External Tools Settings](./jetbrains)
52 |
53 | Notice: These extensions are provided "as-is". IBM does not explicitly endorse, nor support these 3rd party products. Although we will attempt to answer questions through our Slack channel, because we want you to succeed and be happy.
54 |
55 |
56 |
57 | ## Feedback
58 |
59 | We can be reached in the following ways. We encourage and welcome all feedback and suggestions
60 | - [IBM Cloud Tech Slack](https://slack-invite-ibm-cloud-tech.mybluemix.net/): Find us on the `#developer-tools` channel
61 | - [IBM Cloud Developer Tools GitHub repo](https://github.com/IBM-Cloud/ibm-cloud-developer-tools): Use to file any issues specific to installation of the tools or the IDE extensions.
62 |
63 |
--------------------------------------------------------------------------------
/jetbrains/README.md:
--------------------------------------------------------------------------------
1 | # IBM Cloud Developer Tools CLI - Helper for Jetbrains IDEs
2 |
3 | [](https://bluemix.net)
4 |
5 | ### Table of Contents
6 | * [Summary](#summary)
7 | * [Installation](#installation)
8 | * [Usage](#usage)
9 | * [Uninstall](#uninstall)
10 | * [Feedback](#feedback)
11 |
12 |
13 | ## Summary
14 |
15 | This settings JAR file can be imported into any of the [Jetbrains](https://www.jetbrains.com) based IDEs -- IntelliJ, WebStorm, Android Studio, etc -- that will provide new menu entries to call IDT actions from directly within the IDE.
16 |
17 | 
18 |
19 | Notice: This helper is provided "as-is". IBM does not explicitly endorse, nor support 3rd party products. Although, we will attempt to answer questions through our Slack channel, because we want you to succeed and be happy.
20 |
21 |
22 | ## Installation
23 |
24 | Note: You must have previously [installed](../README.md) the IBM Developer Tools CLI.
25 |
26 | 1. Download the [idt-jetbrains-settings.jar](https://github.com/IBM-Cloud/ibm-cloud-developer-tools/raw/master/jetbrains/idt-jetbrains-settings.jar) file
27 | - Note: Do NOT click the jar file in the project files list list above to download. This will not work. Use the link shown in this step.
28 | 1. Open your preferred [Jetbrains IDE](https://www.jetbrains.com)
29 | 1. Select `File` > `Import Settings`, then locate and pick the downloaded *idt-jetbrains-settings.jar* file.
30 |
31 | Once complete, there will be a new "IBM Cloud Developer Tools" entry under the following menus:
32 | - Main "Tools" menu
33 | - Editor context (right-click) menu
34 | - Project context menu
35 | - Search results
36 |
37 |
38 | ## Usage
39 |
40 | You can either start with an existing server-side app, and `Enable` it for the IBM Cloud, or use the IDT CLI to `Create` a new app from a StarterKit (`bx dev create`). Once you have your app's project, open it in your JetBrains IDE.
41 |
42 | If you have a generic server-side app, select `Tools` > `IBM Cloud Developer Tools` > `Enable app for IBM Cloud`. This will check for, and add all required files to enable you to build the app locally, as well as deploy it to IBM Cloud using either as a Cloud Foundry app, or within a Kubernetes cluster.
43 |
44 | Develop your cloud native app as normal, using the basic build/run/deploy actions from the IDT menu. If you need to perform actions that are not in the menu, simply open the Terminal tab and enter the desired commands manually.
45 |
46 | For more information, see the [IBM Cloud Developer Tools documentation](https://console.bluemix.net/docs/cloudnative/dev_cli.html).
47 |
48 |
49 |
50 | ## Uninstall
51 |
52 | If you wish to remove the IBM Developer Tools CLI helper, simply go into `Preferences` > `Tools` > `External Tools`, and then select and delete (minus sign) each entry under the "IBM Cloud Developer Tools" group. The group itself is removed once the final entry is deleted.
53 |
54 |
55 | ## Feedback
56 |
57 | We can be reached in the following ways. We encourage and welcome all feedback and suggestions
58 | - [IBM Cloud Tech Slack](https://slack-invite-ibm-cloud-tech.mybluemix.net/): Find us on the `#developer-tools` channel
59 | - [IBM Cloud Developer Tools GitHub repo](https://github.com/IBM-Cloud/ibm-cloud-developer-tools): Use to file any issues specific to this Jetbrains helper
60 |
61 |
--------------------------------------------------------------------------------
/linux-installer/README.md:
--------------------------------------------------------------------------------
1 | # IBM Developer Tools CLI Installer (idt-installer) for Linux and MacOS
2 |
3 | [](https://bluemix.net)
4 | 
5 |
6 | ### Table of Contents
7 | * [Summary](#summary)
8 | * [Install](#installation)
9 | * [Updating](#updating)
10 | * [Uninstall](#uninstall)
11 | * [Pre-Requisites](#pre-requisites)
12 | * [Usage](#usage)
13 | * [Platform specific concerns](#platforms)
14 | * [MacOS](#macos)
15 | * [Linux](#linux)
16 | * [Windows](#windows)
17 | * [Internal IBM users](#internal-ibm-users)
18 |
19 |
20 | ## Summary
21 |
22 | This script performs an installation of the IBM Developer Tools CLI environment. The IDT consists of the 'dev' (and several other) plugins to the IBM Cloud CLI. Our general target environment is the IBM Cloud, including public, dedicated, and local hybrid.
23 |
24 |
25 | ## Installation
26 | To install the IBM Cloud Developer Tools CLI, run the following command:
27 |
28 | ```
29 | $ curl -sL https://ibm.biz/idt-installer | bash
30 | ```
31 |
32 | Once complete, there will be three added shortcuts defined to access the IDT:
33 | - `ibmcloud dev` : Main command line tool for IBM cloud native development
34 | - `ibmcloud update` : Update your IBM Cloud CLI to the latest version
35 | - `ibmcloud plugin update` : Update IBM Cloud plugins to the latest versions
36 |
37 |
38 | ### Debugging
39 |
40 | If you have any issues with the installer, try running with the `--trace` argument which will produce verbose output to assist us in diagnosing your problem:
41 |
42 | ```
43 | curl -sL https://ibm.biz/idt-installer | bash -s -- --trace
44 | ```
45 |
46 | If you wish to update the IBM Cloud Dev Plugin, run:
47 | ```
48 | ibmcloud plugin update dev
49 | ```
50 |
51 |
52 | ## Updating
53 |
54 | If you wish to update the IBM Cloud Dev Plugin, run `ibmcloud plugin update dev`.
55 |
56 | Syntax:
57 | ```
58 | ibmcloud plugin update dev
59 | ```
60 |
61 |
62 | ## Pre-Requisites
63 |
64 | The script will check for the following prereqs, and attempt to install them if not found.
65 | - Git command line
66 | - Docker command line
67 | - Kubernetes CLI (kubectl)
68 |
69 |
70 | ## Usage
71 | ```
72 | Usage: idt-installer []
73 |
74 | Where is:
75 | install | update [Default] Perform full install (or update) of all needed CLIs and Plugins
76 | help | -h | -? Show this help
77 | --force Force updates of dependencies and other settings during update
78 | --trace Eanble verbose tracing of all activity
79 |
80 |
81 | If "install" (or no action provided), a full CLI installation (or update) will occur:
82 | 1. Pre-req check for 'git', 'docker', and 'kubectl'
83 | 2. Install latest IBM Cloud 'ibmcloud' CLI
84 | 3. Install all required plugins
85 | 4. Defines aliases to improve useability
86 | - ic : Shortcut for "ibmcloud" command
87 |
88 |
89 | Chat with us on Slack: https://slack-invite-ibm-cloud-tech.mybluemix.net/
90 | Submit any issues to : https://github.com/IBM-Cloud/ibm-cloud-developer-tools/issues
91 |
92 | ```
93 |
94 | ## Platforms
95 |
96 | The following are platform specific concerns and notes you should be aware of.
97 |
98 | Note: Previous versions of this installer set up aliases within you shell env (ie ~/.bashrc). Current version have switched over to use a wrapper shell scripty (/usr/local/bin/idt) to achieve better results. The old env entries are automatically removed.
99 |
100 |
101 | ### MacOS
102 |
103 | The installer uses the "homebrew" utility, and it will be installed as needed.
104 |
105 | ### Linux
106 |
107 | This script has only been tested on Ubuntu Linux systems, although it should behave properly on other distros that use 'apt-get'.
108 |
109 | If you run into any issues, please let us know on [IBM Cloud Tech Slack](https://slack-invite-ibm-cloud-tech.mybluemix.net/) - #developer-tools channel, or file an issue on our [GitHub repo](https://github.com/IBM-Cloud/ibm-cloud-developer-tools/issues).
110 |
111 |
112 | ### Windows
113 |
114 | **WARNING**: Windows is not supported by this installer. See the [Windows installation](../windows-installer/README.md) for additional information.
115 |
116 |
117 |
118 | ## Internal IBM users
119 |
120 | IBM users can use pre-release versions of the IDT (ibmcloud and all plugins). The installer will check if you have the internal "stage1" plugin repo defined, and ask if you want to use it for updates. Note: Since during initial install of the ibmcloud CLI does not have extra plugin repos defined, it only applies during subsequent updates.
121 |
122 |
--------------------------------------------------------------------------------
/windows-installer/README.md:
--------------------------------------------------------------------------------
1 | # IBM Developer Tools CLI Installer (idt-installer) for Windows
2 |
3 | [](https://bluemix.net)
4 | 
5 |
6 | ### Table of Contents
7 | * [Summary](#summary)
8 | * [Install](#installation)
9 | * [Updating](#updating)
10 | * [Uninstall](#uninstall)
11 | * [Pre-Requisites](#pre-requisites)
12 | * [Usage](#usage)
13 | * [Internal IBM users](#internal-ibm-users)
14 |
15 |
16 | ## Summary
17 |
18 | PowerShell script that downloads and installs the IBM Cloud CLI, plugins and all of its dependencies on Windows 10 or newer systems. The CLI consists of the 'dev' (and several other) plugins to the IBM Cloud CLI. Our general target environment is the IBM Cloud, including public, dedicated, and local hybrid.
19 |
20 |
21 | ## Installation
22 |
23 | ### Single-line Running
24 | This action will install (or update) the IBM Cloud Developer Tools to your windows system in a single command.
25 |
26 | 1. Open Windows PowerShell by right-clicking and select "Run as Administrator".
27 | 2. Run this command:
28 | ```
29 | Set-ExecutionPolicy Unrestricted; iex(New-Object Net.WebClient).DownloadString('http://ibm.biz/idt-win-installer')
30 | ```
31 |
32 | Once the installation has completed, and you have rebooted your system (as needed), there will be an added shortcut defined to access the IBM Cloud cli:
33 | - `ic`: shortcut for the `ibmcloud` command
34 |
35 |
36 | ### Running from Download
37 | Alternatively, you can use the following approach to perform an installation. This will give you an opportunity to better inspect the activities performed, especially if you are having any issues during installation (shown below).
38 |
39 | 1. Download the `idt-win-installer.ps1` file, or clone this repository.
40 | 2. Open Windows PowerShell by right-clicking and selecting "Run as administrator".
41 | 3. Change directory to wherever the `idt-win-installer.ps1` script is located.
42 | 4. Run the following commands:
43 | ```
44 | Set-ExecutionPolicy Unrestricted
45 | .\idt-win-installer.ps1
46 | ```
47 |
48 | ### Debugging
49 |
50 | If you have any issues with the installer, try running with the `--trace` argument which will produce verbose output to assist us in diagnosing your problem:
51 |
52 | ```
53 | Set-ExecutionPolicy Unrestricted
54 | .\idt-win-installer.ps1 --trace
55 | ```
56 |
57 | If updating an existing IBM Cloud CLI installation, you can run the following:
58 | ```
59 | ibmcloud update
60 | ```
61 |
62 |
63 | ## Updating
64 |
65 | If you wish to update the IBM Developer Tools CLI, run:
66 |
67 | ```
68 | ibmcloud plugin update dev
69 | ```
70 |
71 | This command is simply a shortcut defined during initial install that runs (in admin mode) the installer as shown here:
72 |
73 | ```
74 | PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Unrestricted ""iex(New-Object Net.WebClient).DownloadString(""""http://ibm.biz/idt-win-installer"""")"" ""%2"" ""%3"" ' -Verb RunAs}"
75 | ```
76 |
77 |
78 | ## Pre-Requisites
79 |
80 | The script will check for the following prereqs, and attempt to install them if not found.
81 | - Git command line
82 | - Docker command line
83 | - Kubernetes CLI (kubectl)
84 |
85 |
86 | ## Usage
87 | ```
88 | Usage: idt-win-installer []
89 |
90 | Where is:
91 | install | update [Default] Perform full install (or update) of all needed CLIs and Plugins
92 | help | -h | -? Show this help
93 | --force Force updates of dependencies and other settings during update
94 | --trace Eanble verbose tracing of all activity
95 |
96 |
97 | If "install" (or no action provided), a full CLI installation (or update) will occur:
98 | 1. Pre-req check for 'git', 'docker', and 'kubectl'
99 | 2. Install latest IBM Cloud 'ibmcloud' CLI
100 | 3. Install all required plugins
101 | 4. Defines aliases to improve useability
102 | - ic : Shortcut for "ibmcloud" command
103 |
104 |
105 | Chat with us on Slack: https://slack-invite-ibm-cloud-tech.mybluemix.net/
106 | Submit any issues to : https://github.com/IBM-Cloud/ibm-cloud-developer-tools/issues
107 |
108 | ```
109 |
110 |
111 | ## Internal IBM users
112 |
113 | IBM users can use pre-release versions of the IDT (ibmcloud and all plugins). The installer will check if you have the internal "stage1" plugin repo defined, and ask if you want to use it for updates. Note: Since during initial install of the ibmcloud CLI does not have extra plugin repos defined, it only applies during subsequent updates.
114 |
115 |
116 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/windows-installer/idt-win-installer.ps1:
--------------------------------------------------------------------------------
1 | #------------------------------------------------------------------------------
2 | # Script: idt-win-installer
3 | #------------------------------------------------------------------------------
4 | # IBM Cloud Developer Tools - CLI installer script for Windows 10 systems
5 | #------------------------------------------------------------------------------
6 | # Copyright (c) 2019, International Business Machines. All Rights Reserved.
7 | #------------------------------------------------------------------------------
8 | $Global:VERSION="1.2.2"
9 | $Global:PROG="IBM Cloud Developer Tools - Installer for Windows"
10 |
11 | $Global:INSTALLER_URL="https://ibm.biz/idt-win-installer"
12 | $Global:GIT_URL="https://github.com/IBM-Cloud/ibm-cloud-developer-tools"
13 | $Global:SLACK_URL="https://slack-invite-ibm-cloud-tech.mybluemix.net/"
14 | $Global:IDT_INSTALL_BMX_URL="https://clis.cloud.ibm.com/install"
15 | $Global:IDT_INSTALL_BMX_REPO_NAME="Bluemix"
16 | $Global:IDT_INSTALL_BMX_REPO_URL="https://plugins.cloud.ibm.com"
17 |
18 | $Global:FORCE = $false
19 | $Global:NEEDS_REBOOT = $false
20 | $Global:SECS = 0
21 |
22 | #------------------------------------------------------------------------------
23 | function help {
24 | Write-Output @"
25 |
26 | $Global:PROG
27 | Usage: idt-win-installer []
28 |
29 | Where is:
30 | install | update [Default] Perform install (or update) of all needed CLIs and Plugins
31 | help Show this help
32 | --force | -f Force updates of dependencies and other settings during update
33 | --trace Eanble verbose tracing of all activity
34 |
35 | If "install", "update", or no action, a full CLI installation (or update) will occur:
36 | 1. Pre-req check for 'git', 'docker', and 'kubectl'
37 | 2. Install latest IBM Cloud 'ibmcloud' CLI
38 | 3. Install all required plugins
39 |
40 | Chat with us on Slack: $Global:SLACK_URL, channel #developer-tools
41 | Submit any issues to : $Global:GIT_URL/issues
42 |
43 | "@
44 | }
45 |
46 |
47 | #------------------------------------------------------------------------------
48 | function log() {
49 | Write-Host "[$((Get-PSCallStack)[1].Command)] " -foreground cyan -nonewline
50 | Write-Host $args
51 | }
52 |
53 | function warn() {
54 | Write-Host "[$((Get-PSCallStack)[1].Command)] " -foreground cyan -nonewline
55 | Write-Host "WARN" -foreground yellow -nonewline
56 | Write-Host ": $args"
57 | }
58 |
59 | function error() {
60 | Write-Host "[$((Get-PSCallStack)[1].Command)] " -foreground cyan -nonewline
61 | Write-Host "ERROR" -foreground red -nonewline
62 | Write-Host ": $args"
63 | quit
64 | }
65 |
66 | #------------------------------------------------------------------------------
67 | function quit() {
68 | $Global:SECS = (Get-Date)-$Global:SECS
69 | log "--==[ Finished. Total time: $($Global:SECS.ToString("hh\:mm\:ss")) seconds ]==--"
70 | Write-Host ""
71 |
72 | #-- Request Restart to save changes to PATH.
73 | if ( $Global:NEEDS_REBOOT ) {
74 | $restart = Read-Host -Prompt "A system restart is required. Would you like to restart now (y/N)?"
75 | if($restart -match "[Yy]" ) {
76 | Restart-Computer
77 | } else {
78 | Write-Host "Note: Reboot still needed to load env variables."
79 | }
80 | } else {
81 | # If running in the console, wait for input before closing.
82 | if ($Host.Name -eq "ConsoleHost") {
83 | Write-Host "Press any key to continue..."
84 | $Host.UI.RawUI.FlushInputBuffer() # Make sure buffered input doesn't "press a key" and skip the ReadKey().
85 | $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
86 |
87 | #-- turn opff trace
88 | Set-PSDebug -Trace 0
89 | }
90 | }
91 | }
92 |
93 | #------------------------------------------------------------------------------
94 | function install() {
95 | log "Starting Installation/Update..."
96 |
97 | #-- Check if internal IBM setup
98 | $ibmcloud_command = get-command ibmcloud -erroraction 'silentlycontinue'
99 | if( $ibmcloud_command ) {
100 | # The command is set, use it
101 | } else {
102 | $ibmcloud_command = 'C:\"Program Files"\IBM\Cloud\bin\ibmcloud.exe'
103 | }
104 | $pluginlist = iex "$ibmcloud_command plugin list"
105 | if($pluginlist -match "\bstage\b") {
106 | Write-Output
107 | $reply = Read-Host -Prompt "Use IBM internal repos for install/updates (Y/n)?"
108 | Write-Output
109 | if($reply -match "[Yy]*") {
110 | $Global:IDT_INSTALL_BMX_URL="https://clis.stage1.ng.bluemix.net/install"
111 | $Global:IDT_INSTALL_BMX_REPO_NAME="stage1"
112 | $Global:IDT_INSTALL_BMX_REPO_URL="https://plugins.stage1.ng.bluemix.net"
113 | }
114 | }
115 |
116 | install_deps
117 | install_ibmcloud
118 | install_plugins
119 | env_setup add
120 |
121 | log "Install finished."
122 |
123 | }
124 |
125 |
126 | #------------------------------------------------------------------------------
127 | #-- Install dependencies - git, docker, kubectl.
128 | function install_deps() {
129 |
130 | [Net.ServicePointManager]::SecurityProtocol = "Tls12, Tls11, Tls, Ssl3"
131 |
132 | #-- git
133 | log "Checking for external dependency: git"
134 | if( -not (get-command git -erroraction 'silentlycontinue') -or $Global:FORCE) {
135 |
136 | log "Installing/updating external dependency: git"
137 | Invoke-WebRequest "https://github.com/git-for-windows/git/releases/download/v2.32.0.windows.2/Git-2.32.0.2-64-bit.exe" -UseBasicParsing -outfile "git-installer.exe"
138 | .\git-installer.exe /SILENT /PathOption="Cmd" | Out-Null
139 | Remove-Item "git-installer.exe"
140 | $Global:NEEDS_REBOOT = $true
141 | log "Install/update completed for: git"
142 | }
143 |
144 | #-- docker
145 | log "Checking for external dependency: docker"
146 | if( -not(get-command docker -erroraction 'silentlycontinue') -or $Global:FORCE) {
147 | log "Installing/updating external dependency: docker"
148 | Invoke-WebRequest "https://desktop.docker.com/win/stable/amd64/Docker%20Desktop%20Installer.exe" -UseBasicParsing -outfile "InstallDocker.exe"
149 | .\InstallDocker.exe | Out-Null
150 | $Global:NEEDS_REBOOT = $false
151 | log "Install/update completed for: docker"
152 | }
153 |
154 | #-- kubectl
155 | log "Checking for external dependency: kubectl"
156 | if( -not( get-command kubectl -erroraction 'silentlycontinue') -or $Global:FORCE) {
157 | log "Installing/updating external dependency: kubectl"
158 |
159 | $response = Invoke-RestMethod "https://containers.cloud.ibm.com/v1/kube-versions"
160 | for ($i = 0; $i -lt $response.Length; $i++){
161 | if ($response[$i].default){
162 | $kube_version = "v" + $response[$i].major + "." + $response[$i].minor + "." +$response[$i].patch
163 | break
164 | }
165 | }
166 | Invoke-WebRequest "https://storage.googleapis.com/kubernetes-release/release/$kube_version/bin/windows/amd64/kubectl.exe" -UseBasicParsing -outfile "kubectl.exe"
167 | mkdir "C:\Program Files\kubectl" -erroraction 'silentlycontinue'
168 | Move-Item -Path "kubectl.exe" -Destination "C:\Program Files\kubectl" -force
169 | add_to_path("C:\Program Files\kubectl")
170 | $Global:NEEDS_REBOOT = $true
171 | log "Install/update completed for: kubectl"
172 | }
173 |
174 | # #-- helm
175 | # log "Checking for external dependency: helm"
176 | # if( -not (get-command helm -erroraction 'silentlycontinue') -or $Global:FORCE) {
177 | # log "Installing/updating external dependency: helm"
178 | # [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
179 | # $helm_url = ((Invoke-WebRequest https://github.com/helm/helm/releases -UseBasicParsing).Links.OuterHTML | Where-Object{$_ -match '.+?windows-amd64.zip'} | Select-Object -first 1).Split('"')[1]
180 | # log "Helm URL : $helm_url"
181 | # $helm_file = $helm_url.Split("/")[-1]
182 | # log "Helm File: $helm_file"
183 | # Invoke-WebRequest $helm_url -UseBasicParsing -outfile "$helm_file"
184 | # mkdir "C:\Program Files\helm" -ErrorAction SilentlyContinue
185 | # if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) {
186 | # Install-Package -Scope CurrentUser -Force 7Zip4PowerShell > $null
187 | # }
188 | # Expand-7Zip $helm_file .
189 | # $tar_file = $helm_file.Replace('.gz','')
190 | # Expand-7Zip $tar_file "C:\Program Files\helm"
191 | # Remove-Item $helm_file -erroraction 'silentlycontinue'
192 | # Remove-Item $tar_file -erroraction 'silentlycontinue'
193 | # add_to_path("C:\Program Files\helm\windows-amd64")
194 | # $Global:NEEDS_REBOOT = $true
195 | # log "Install/update completed for: helm"
196 | # }
197 | }
198 |
199 | #------------------------------------------------------------------------------
200 | #-- Add a dir to the system path
201 | function add_to_path {
202 | Param($path)
203 | # Directly edit the registery to add kubectl to PATH. Will require a restart to stick.
204 | $regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
205 | $value = (Get-ItemProperty $regPath -Name Path).Path
206 | if ( -not ($value -match [Regex]::Escape("$path") )) {
207 | log "Adding $path to PATH"
208 | $newValue = "$value;$path"
209 | Set-ItemProperty -Path $regPath -Name Path -Value $newValue | Out-Null
210 | }
211 | }
212 |
213 | #------------------------------------------------------------------------------
214 | #-- Install IBM Cloud CLI.
215 | function install_ibmcloud() {
216 | if( get-command ibmcloud -erroraction 'silentlycontinue') {
217 | Write-Output "ibmcloud already installed"
218 | if( $Global:FORCE ){
219 | # User wants forced update
220 | ibmcloud update -f
221 | } else {
222 | # User will be prompted if they want to update
223 | ibmcloud update
224 | }
225 |
226 | } else {
227 | log "Installing 'ibmcloud' CLI for Windows..."
228 | $url = $Global:IDT_INSTALL_BMX_URL + "/powershell"
229 | log "Downloading and installing 'ibmcloud' CLI from: $url"
230 | Invoke-Expression(New-Object Net.WebClient).DownloadString( $url )
231 | $Global:NEEDS_REBOOT = $true
232 | $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
233 | }
234 | log "IBM Cloud CLI version:"
235 | $ibmcloud_command = get-command ibmcloud -erroraction 'silentlycontinue'
236 | if( $ibmcloud_command ) {
237 | # The command is set, use it
238 | } else {
239 | $ibmcloud_command = 'C:\"Program Files"\IBM\Cloud\bin\ibmcloud.exe'
240 | }
241 | iex "$ibmcloud_command --version"
242 | }
243 |
244 | #------------------------------------------------------------------------------
245 | #-- Install IBM Cloud CLI Plugins.
246 | function install_plugins {
247 | log "Installing/updating IBM Cloud CLI plugins..."
248 | $plugins = "Cloud-Functions",
249 | "container-registry",
250 | "container-service"
251 |
252 | $ibmcloud_command = get-command ibmcloud -erroraction 'silentlycontinue'
253 | if( $ibmcloud_command ) {
254 | # The command is set, use it
255 | } else {
256 | $ibmcloud_command = 'C:\"Program Files"\IBM\Cloud\bin\ibmcloud.exe'
257 | }
258 | $pluginlist = iex "$ibmcloud_command plugin list"
259 |
260 | Foreach ($plugin in $plugins) {
261 | log "Checking status of plugin: $plugin"
262 | if($pluginlist -match "\b$plugin\b") {
263 | log "Updating plugin '$plugin'"
264 | iex "$ibmcloud_command plugin update -r $Global:IDT_INSTALL_BMX_REPO_NAME $plugin"
265 | } else {
266 | log "Installing plugin '$plugin'"
267 | iex "$ibmcloud_command plugin install -f -r $Global:IDT_INSTALL_BMX_REPO_NAME $plugin"
268 | }
269 | }
270 | log "Running 'ibmcloud plugin list'..."
271 | iex "$ibmcloud_command plugin list"
272 | log "Finished installing/updating plugins"
273 | }
274 |
275 | #------------------------------------------------------------------------------
276 | #-- Create "ic" script to act as shortcut to "ibmcloud"
277 | function env_setup() {
278 | $ic_command = get-command ic -erroraction 'silentlycontinue'
279 | if ( $ic_command ) {
280 | # the command is set, use its existing location
281 | } else {
282 | Write-Output "Creating 'ic' script to act as shortcut to 'ibmcloud' command..."
283 | $ic_batch = @"
284 | @ECHO OFF
285 | REM #-----------------------------------------------------------
286 | REM # IBM Cloud Shortcut
287 | REM # Shortcut for 'ibmcloud' command
288 | REM #-----------------------------------------------------------
289 | ibmcloud %*
290 | "@
291 | $ic_command = 'C:\Program Files\IBM\Cloud\bin\ic.bat'
292 | Write-Output $ic_batch | Out-File -Encoding ascii $ic_command
293 | }
294 | }
295 |
296 | #------------------------------------------------------------------------------
297 | # MAIN
298 | #------------------------------------------------------------------------------
299 | function main {
300 | log "--==[ $Global:PROG, v$Global:VERSION ]==--"
301 | $Global:SECS = (Get-Date)
302 |
303 | #-- Check for Windows 10
304 | if ([System.Environment]::OSVersion.Version.Major -lt 10) {
305 | error "This installer requires Windows 10 or higher."
306 | }
307 |
308 | #-- Check for 64-bit Platform - Dev do not have 32-bit versions.
309 | if ([Environment]::Is64BitProcess -ne [Environment]::Is64BitOperatingSystem) {
310 | error "This installer requires 64-bit Windows."
311 | }
312 |
313 | If(-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
314 | [Security.Principal.WindowsBuiltInRole] "Administrator")) {
315 | error "This script must be run as Administrator. Re-run this script as an Administrator!"
316 | }
317 |
318 | #-- Running as admin defaults to system32 change to home directory.
319 | Set-Location ~
320 |
321 | $ACTION="install"
322 |
323 | #-- Parse args
324 | foreach ($arg in $args) {
325 | switch -exact ($arg) {
326 | "--trace" {
327 | warn "Enabling verbose tracing of all activity"
328 | Set-PSDebug -Trace 1
329 | }
330 | "--force" {
331 | $Global:FORCE=$true
332 | warn "Forcing updates for all dependencies and other settings"
333 | }
334 | "update" { $ACTION = "install" }
335 | "install" { $ACTION = "install" }
336 | "help" { $ACTION = "help" }
337 | default { warn "Undefined Arg: $arg" }
338 | }
339 | }
340 | switch -exact ($ACTION) {
341 | "install" { install }
342 | default { help }
343 | }
344 |
345 | quit
346 | }
347 |
348 | #------------------------------------------------------------------------------
349 | #-- Kick things off
350 | #------------------------------------------------------------------------------
351 | main $args
352 |
353 | #------------------------------------------------------------------------------
354 | # EOF
355 | #------------------------------------------------------------------------------
356 |
--------------------------------------------------------------------------------
/linux-installer/idt-installer:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #------------------------------------------------------------------------------
3 | # Script: idt-installer
4 | #------------------------------------------------------------------------------
5 | # IBM Cloud Developer Tools - CLI installer script for MacOS and Linux systems
6 | #------------------------------------------------------------------------------
7 | # Copyright (c) 2018, International Business Machines. All Rights Reserved.
8 | #------------------------------------------------------------------------------
9 |
10 | VERSION="1.2.3"
11 | PROG="IBM Cloud Developer Tools for Linux/MacOS - Installer"
12 | INSTALLER_URL="https://ibm.biz/idt-installer"
13 | GIT_URL="https://github.com/IBM-Cloud/ibm-cloud-developer-tools"
14 | SLACK_URL="https://slack-invite-ibm-cloud-tech.mybluemix.net/"
15 | IDT_INSTALL_BMX_URL="https://clis.cloud.ibm.com/install"
16 | IDT_INSTALL_BMX_REPO_NAME="Bluemix"
17 | IDT_INSTALL_BMX_REPO_URL="https://plugins.cloud.ibm.com"
18 |
19 | #------------------------------------------------------------------------------
20 | function help {
21 | cat <<-!!EOF
22 |
23 | ${PROG}
24 | Usage: idt-installer []
25 |
26 | Where is:
27 | install [Default] Perform full install (or update) of all needed CLIs and Plugins
28 | help | -h | -? Show this help
29 | --force Force updates of dependencies and other settings during update
30 | --trace Eanble verbose tracing of all activity
31 |
32 | If "install" (or no action provided), a full CLI installation (or update) will occur:
33 | 1. Pre-req check for 'git', 'docker', and 'kubectl'
34 | 2. Install latest IBM Cloud 'ibmcloud' CLI
35 | 3. Install all required plugins
36 |
37 | Chat with us on Slack: ${SLACK_URL}, channel #developer-tools
38 | Submit any issues to : ${GIT_URL}/issues
39 |
40 | !!EOF
41 | }
42 |
43 |
44 | #------------------------------------------------------------------------------
45 | #-- ${FUNCNAME[1]} == Calling function's name
46 | #-- Colors escape seqs
47 | YEL='\033[1;33m'
48 | CYN='\033[0;36m'
49 | GRN='\033[1;32m'
50 | RED='\033[1;31m'
51 | NRM='\033[0m'
52 |
53 | function log {
54 | echo -e "${CYN}[${FUNCNAME[1]}]${NRM} $*"
55 | }
56 |
57 | function warn {
58 | echo -e "${CYN}[${FUNCNAME[1]}]${NRM} ${YEL}WARN${NRM}: $*"
59 | }
60 |
61 | function error {
62 | echo -e "${CYN}[${FUNCNAME[1]}]${NRM} ${RED}ERROR${NRM}: $*"
63 | exit -1
64 | }
65 |
66 |
67 | function prompt {
68 | label=${1}
69 | default=${2}
70 | if [[ -z $default ]]; then
71 | echo -en "${label}: ${CYN}" > /dev/tty
72 | else
73 | echo -en "${label} [$default]: ${CYN}" > /dev/tty
74 | fi
75 | read -r
76 | echo -e "${NRM}" > /dev/tty
77 | #-- Use $REPLY to get user's input
78 | }
79 |
80 | #------------------------------------------------------------------------------
81 | function install {
82 | if [[ -n "$(which ibmcloud)" ]]; then
83 | log "Starting Installation..."
84 | else
85 | log "Starting Update..."
86 | fi
87 |
88 | #-- Check if internal IBM setup
89 | if [[ -n "$(which ibmcloud)" ]]; then
90 | read -r repo url <<< $(ibmcloud plugin repos | grep stage1)
91 | if [[ -n "$repo" ]]; then
92 | echo
93 | prompt "Use IBM internal '$repo' repos for install/updates (Y/n)?"
94 | echo
95 | if [[ "$REPLY" != [Nn]* ]]; then
96 | IDT_INSTALL_BMX_URL="https://clis.stage1.ng.bluemix.net/install"
97 | IDT_INSTALL_BMX_REPO_NAME="${repo}"
98 | IDT_INSTALL_BMX_REPO_URL="${url}"
99 | fi
100 | fi
101 | fi
102 | [ "$SUDO" ] && log "Note: You may be prompted for your 'sudo' password during install."
103 |
104 | install_deps
105 | install_ibmcloud
106 | install_plugins
107 | env_setup add
108 |
109 | log "Install finished."
110 | }
111 |
112 | #------------------------------------------------------------------------------
113 | function install_deps {
114 | #-- check for/install brew for macos
115 | case "$PLATFORM" in
116 | "Darwin")
117 | install_darwin_deps
118 | ;;
119 | "Linux")
120 | if [[ "${DISTRO}" == *Ubuntu* || "${DISTRO}" == *Debian* ]]; then
121 | install_deps_with_apt_get
122 | elif [[ "${DISTRO}" == *Red*Hat* || "${DISTRO}" == *CentOS* || "${DISTRO}" == *RHEL* || "${DISTRO}" == *Fedora* ]]; then
123 | install_deps_with_yum
124 | else
125 | error "This script has not been updated for use with your linux distribution (${DISTRO})"
126 | fi
127 | ;;
128 | esac
129 |
130 | }
131 |
132 | #------------------------------------------------------------------------------
133 | function install_darwin_deps {
134 | log "Checking for external dependency: brew"
135 | if [[ -z "$(which brew)" && -n "$(which ruby)" ]]; then
136 | log "'brew' installer not found, attempting to install..."
137 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
138 | log "'brew' installation completed."
139 | fi
140 | if [[ "$FORCE" == true ]]; then
141 | log "Updating 'brew'..."
142 | brew update
143 | fi
144 |
145 | #-- GIT:
146 | log "Installing/updating external dependency: git"
147 | if [[ -z "$(which git)" ]]; then
148 | brew install git
149 | log "Please review any setup requirements for 'git' from: https://git-scm.com/downloads"
150 | elif [[ "$FORCE" == true ]]; then
151 | brew upgrade git
152 | fi
153 |
154 | #-- Docker:
155 | log "Installing/updating external dependency: docker"
156 | if [[ -z "$(which docker)" ]]; then
157 | brew install --cask docker
158 | log "Please review any setup requirements for 'docker' from: https://docs.docker.com/engine/installation/"
159 | elif [[ "$FORCE" == true ]]; then
160 | brew reinstall --cask docker
161 | fi
162 |
163 | #-- kubectl:
164 | log "Installing/updating external dependency: kubectl"
165 | if [[ -z "$(which kubectl)" || "$FORCE" == true ]]; then
166 | local kube_version=$(get_kubectl_version)
167 | curl --progress-bar -LO https://storage.googleapis.com/kubernetes-release/release/v$kube_version/bin/darwin/amd64/kubectl
168 | $SUDO mv ./kubectl /usr/local/bin/kubectl
169 | $SUDO chmod +x /usr/local/bin/kubectl
170 | log "Please review any setup requirements for 'kubectl' from: https://kubernetes.io/docs/tasks/tools/install-kubectl/"
171 | fi
172 |
173 | # #-- helm:
174 | # log "Installing/updating external dependency: helm"
175 | # if [[ -z "$(which helm)" ]]; then
176 | # brew install kubernetes-helm
177 | # log "Please review any setup requirements for 'helm' from: https://github.com/kubernetes/helm/blob/master/docs/install.md"
178 | # elif [[ "$FORCE" == true ]]; then
179 | # brew upgrade kubernetes-helm
180 | # fi
181 | }
182 |
183 | #------------------------------------------------------------------------------
184 | function install_deps_with_apt_get {
185 | log "Checking for and updating 'apt-get' support on Linux"
186 | if [[ -z "$(which apt-get)" ]]; then
187 | error "'apt-get' is not found. That's the only Debian/Ubuntu linux installer I know, sorry."
188 | fi
189 | $SUDO apt-get -y -qq update > /dev/null
190 | if [[ -z "$(which add-apt-repository)" ]]; then
191 | if [ "$(apt-cache search software-properties-common | wc -l)" != "0" ]; then
192 | log "Installing package: software-properties-common"
193 | $SUDO apt-get install -yqq software-properties-common > /dev/null 2>&1
194 | fi
195 | if [ "$(apt-cache search python-software-properties | wc -l)" != "0" ]; then
196 | log "Installing package: python-software-properties"
197 | $SUDO apt-get install -yqq python-software-properties > /dev/null 2>&1
198 | fi
199 | fi
200 | $SUDO add-apt-repository -y ppa:git-core/ppa
201 | $SUDO apt-get -y update
202 |
203 | #-- CURL:
204 | log "Installing/updating external dependency: curl"
205 | if [[ -z "$(which curl)" || "$FORCE" == true ]]; then
206 | $SUDO apt-get -y install curl
207 | fi
208 |
209 | #-- GIT:
210 | log "Installing/updating external dependency: git"
211 | if [[ -z "$(which git)" || "$FORCE" == true ]]; then
212 | $SUDO apt-get -y install git
213 | log "Please review any setup requirements for 'git' from: https://git-scm.com/downloads"
214 | fi
215 |
216 | #-- Docker:
217 | install_docker
218 |
219 | #-- kubectl:
220 | log "Installing/updating external dependency: kubectl"
221 | if [[ -z "$(which kubectl)" || "$FORCE" == true ]]; then
222 | local kube_version=$(get_kubectl_version)
223 | curl --progress-bar -LO https://storage.googleapis.com/kubernetes-release/release/v$kube_version/bin/linux/amd64/kubectl
224 | $SUDO mv ./kubectl /usr/local/bin/kubectl
225 | $SUDO chmod +x /usr/local/bin/kubectl
226 | log "Please review any setup requirements for 'kubectl' from: https://kubernetes.io/docs/tasks/tools/install-kubectl/"
227 | fi
228 |
229 | # #-- helm:
230 | # log "Installing/updating external dependency: helm"
231 | # if [[ -z "$(which helm)" || "$FORCE" == true ]]; then
232 | # curl -fsSL https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
233 | # log "Please review any setup requirements for 'helm' from: https://github.com/kubernetes/helm/blob/master/docs/install.md"
234 | # fi
235 | }
236 |
237 | #------------------------------------------------------------------------------
238 | function install_deps_with_yum {
239 | log "Checking for and updating 'yum' support on Linux"
240 | if [[ -z "$(which yum)" ]]; then
241 | error "'yum' is not found. That's the only RedHat/Centos linux installer I know, sorry."
242 | fi
243 |
244 | #-- CURL:
245 | log "Installing/updating external dependency: curl"
246 | if [[ -z "$(which curl)" || "$FORCE" == true ]]; then
247 | $SUDO yum -y install curl
248 | fi
249 | #-- GIT:
250 | log "Installing/updating external dependency: git"
251 | if [[ -z "$(which git)" || "$FORCE" == true ]]; then
252 | $SUDO yum install -y git
253 | log "Please review any setup requirements for 'git' from: https://git-scm.com/downloads"
254 | fi
255 |
256 | #-- Docker:
257 | install_docker
258 |
259 | #-- kubectl:
260 | log "Installing/updating external dependency: kubectl"
261 | if [[ -z "$(which kubectl)" || "$FORCE" == true ]]; then
262 | $SUDO sh -c 'printf "[kubernetes]\nname=Kubernetes\nbaseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg\n" > /etc/yum.repos.d/kubernetes.repo'
263 | local kube_version=$(get_kubectl_version)
264 | local kube_yum_version=$(yum --showduplicates list kubectl -y | grep -Eo "($kube_version\-[0-9*])")
265 | $SUDO yum install -y kubectl-$kube_yum_version
266 | log "Please review any setup requirements for 'kubectl' from: https://kubernetes.io/docs/tasks/tools/install-kubectl/"
267 | fi
268 |
269 | # #-- helm:
270 | # log "Installing/updating external dependency: helm"
271 | # if [[ -z "$(which helm)" || "$FORCE" == true ]]; then
272 | # curl -fsSL https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
273 | # log "Please review any setup requirements for 'helm' from: https://github.com/kubernetes/helm/blob/master/docs/install.md"
274 | # fi
275 | }
276 |
277 | #------------------------------------------------------------------------------
278 | function install_docker {
279 |
280 | #-- Docker:
281 | log "Installing/updating external dependency: docker"
282 | if [[ -z "$(which docker)" || "$FORCE" == true ]]; then
283 | curl -fsSL get.docker.com | $SUDO sh -
284 | if [ "$SUDO" ]; then
285 | # Allow docker to run as a non-root user (if not running as root).
286 | sudo groupadd docker 2>/dev/null
287 | sudo usermod -aG docker $USER 2>/dev/null
288 | else
289 | log 'If you want to run docker without sudo run: "sudo groupadd docker && sudo usermod -aG docker $USER"'
290 | fi
291 | log "Please review any setup requirements for 'docker' from: https://docs.docker.com/engine/installation/"
292 | fi
293 | docker version
294 | }
295 |
296 | #------------------------------------------------------------------------------
297 | function install_ibmcloud {
298 | if [[ -z "$(which ibmcloud)" ]]; then
299 | log "Installing IBM Cloud 'ibmcloud' CLI for platform '${PLATFORM}'..."
300 | case "$PLATFORM" in
301 | "Darwin")
302 | log "Downloading and installing IBM Cloud 'ibmcloud' CLI from: ${IDT_INSTALL_BMX_URL}/osx"
303 | sh <(curl -fsSL ${IDT_INSTALL_BMX_URL}/osx)
304 | ;;
305 | "Linux")
306 | log "Downloading and installing IBM Cloud 'ibmcloud' CLI from: ${IDT_INSTALL_BMX_URL}/linux"
307 | sh <(curl -fsSL ${IDT_INSTALL_BMX_URL}/linux)
308 | ;;
309 | esac
310 | log "IBM Cloud 'ibmcloud' CLI install finished."
311 | else #-- Upgrade
312 | log "Updating existing IBM Cloud 'ibmcloud' CLI..."
313 | if [[ "$FORCE" == true ]]; then
314 | ibmcloud update -f
315 | else
316 | ibmcloud update
317 | fi
318 | fi
319 | log "Running 'ibmcloud --version'..."
320 | ibmcloud --version
321 | }
322 |
323 | #------------------------------------------------------------------------------
324 | function install_plugins {
325 | #-- ibmcloud plugins to process
326 | PLUGINS=(
327 | "cloud-functions"
328 | "cloud-object-storage"
329 | "container-registry"
330 | "container-service"
331 | )
332 |
333 | log "Installing/updating IBM Cloud CLI plugins..."
334 | for plugin in "${PLUGINS[@]}"; do
335 | log "Checking status of plugin: ${plugin}"
336 | read -r p ver <<< "$(ibmcloud plugin list | grep "^${plugin} ")"
337 | if [[ -z "$p" ]]; then
338 | log "Installing plugin '$plugin'"
339 | ibmcloud plugin install -f -r "${IDT_INSTALL_BMX_REPO_NAME}" "$plugin"
340 | else
341 | log "Updating plugin '$plugin' from version '$ver'"
342 | ibmcloud plugin update -r "${IDT_INSTALL_BMX_REPO_NAME}" "$plugin"
343 | fi
344 | done
345 | log "Running 'ibmcloud plugin list'..."
346 | ibmcloud plugin list
347 | log "Finished installing/updating plugins"
348 | }
349 |
350 | #------------------------------------------------------------------------------
351 | function env_setup {
352 | env_file=""
353 |
354 | if [[ -f ~/.bashrc ]] ; then env_file=~/.bashrc
355 | elif [[ -f ~/.bash_profile ]]; then env_file=~/.bash_profile
356 | elif [[ -f ~/.profile ]] ; then env_file=~/.profile
357 | elif [[ -f ~/.zshrc ]] ; then env_file=~/.zshrc
358 | fi
359 |
360 |
361 | #-- Clear up any old aliases
362 | if [[ -n "$(grep 'alias idt="ibmcloud dev"' "$env_file")" ]]; then
363 | log "Removing old 'idt' aliases from: ${env_file}"
364 | sed -E -i ".idt_uninstall_bak" \
365 | -e '/^#-- Added by the IDT Installer$/d' \
366 | -e '/^alias idt=\"ibmcloud dev\"$/d' \
367 | -e '/^alias idt-update=/d' \
368 | -e '/^alias idt-uninstall=/d' \
369 | ${env_file}
370 | warn "Please restart your shell so old 'idt' alias does not get picked up!"
371 | warn "Symptom is: running 'idt update' results in 'update is not a defined command'."
372 | fi
373 |
374 | if [[ "$1" == "add" && $(grep "alias ic=" $env_file) == "" ]]; then
375 | #-- Add alias "ic"
376 | echo 'alias ic="ibmcloud"' >> ${env_file}
377 | warn "Please restart your shell to enable 'ic' alias for ibmcloud!"
378 | fi
379 | }
380 |
381 | function get_kubectl_version {
382 | # get supported kubectl versions for IBM Cloud kubernetes clusters
383 | local result=$(curl -X GET --header 'Accept: application/json' 'https://containers.cloud.ibm.com/v1/kube-versions' | grep -Eo "\{[^}]*\"default\"\:\s*true[^{]*\}")
384 | local major=$( echo $result | grep -Eo \"major\"\:\s*[0-9]* | grep -Eo [0-9]+ )
385 | local minor=$( echo $result | grep -Eo \"minor\"\:\s*[0-9]* | grep -Eo [0-9]+ )
386 | local patch=$( echo $result | grep -Eo \"patch\"\:\s*[0-9]* | grep -Eo [0-9]+ )
387 | echo "$major.$minor.$patch"
388 | }
389 |
390 | #------------------------------------------------------------------------------
391 | # MAIN
392 | #------------------------------------------------------------------------------
393 | function main {
394 | log "--==[ ${GRN}${PROG}, v${VERSION}${NRM} ]==--"
395 | (( SECS = SECONDS ))
396 |
397 | TMPDIR=${TMPDIR:-"/tmp"}
398 | PLATFORM=$(uname)
399 | ACTION=""
400 |
401 | # Only use sudo if not running as root:
402 | [ "$(id -u)" -ne 0 ] && SUDO=sudo || SUDO=""
403 |
404 | #-- Parse args
405 | while [[ $# -gt 0 ]]; do
406 | case "$1" in
407 | "--trace")
408 | warn "Enabling verbose tracing of all activity"
409 | set -x
410 | ;;
411 | "--force")
412 | FORCE=true
413 | warn "Forcing updates for all dependencies and other settings"
414 | ;;
415 | "update") ACTION="install";;
416 | "install") ACTION="install";;
417 | "help") ACTION="help";;
418 | esac
419 | shift
420 | done
421 |
422 | case "$PLATFORM" in
423 | "Darwin")
424 | ;;
425 | "Linux")
426 | # Linux distro, e.g "Ubuntu", "RedHatEnterpriseWorkstation", "RedHatEnterpriseServer", "CentOS", "Debian"
427 | DISTRO=$(lsb_release -ds 2>/dev/null || cat /etc/*release 2>/dev/null | head -n1 || uname -om || echo "")
428 | if [[ "$DISTRO" != *Ubuntu* && "$DISTRO" != *Red*Hat* && "$DISTRO" != *CentOS* && "$DISTRO" != *Debian* && "$DISTRO" != *RHEL* && "$DISTRO" != *Fedora* ]]; then
429 | warn "Linux has only been tested on Ubuntu, RedHat, Centos, Debian and Fedora distrubutions please let us know if you use this utility on other Distros"
430 | fi
431 | ;;
432 | *)
433 | warn "Only MacOS and Linux systems are supported by this installer."
434 | warn "For Windows, please follow manual installation instructions at:"
435 | warn "${GIT_URL}"
436 | error "Unsupported platform: ${PLATFORM}"
437 | ;;
438 | esac
439 |
440 | case "$ACTION" in
441 | "") install;;
442 | "install") install;;
443 | *) help;;
444 | esac
445 |
446 | (( SECS = SECONDS - SECS ))
447 | log "--==[ ${GRN}Total time: ${SECS} seconds${NRM} ]==--"
448 | }
449 |
450 | #------------------------------------------------------------------------------
451 | #-- Kick things off
452 | #------------------------------------------------------------------------------
453 | main "$@"
454 |
--------------------------------------------------------------------------------