-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Scaffold a requirements.yml file for collection dependencies #2652
Changes from all commits
33f1319
e05d9c3
c7ecb7a
23f518b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,9 @@ type DockerfileHybrid struct { | |
|
||
// Watches - if true, include a COPY statement for watches.yaml | ||
Watches bool | ||
|
||
// Requirements - if true, include a COPY and RUN to install Ansible requirements | ||
Requirements bool | ||
} | ||
|
||
// GetInput - gets the input | ||
|
@@ -73,13 +76,12 @@ RUN yum clean all && rm -rf /var/cache/yum/* \ | |
&& pip3 install --no-cache-dir --ignore-installed ipaddress \ | ||
ansible-runner==1.3.4 \ | ||
ansible-runner-http==1.0.0 \ | ||
openshift==0.9.2 \ | ||
openshift~=0.10.0 \ | ||
ansible~=2.9 \ | ||
jmespath \ | ||
&& yum remove -y gcc libffi-devel openssl-devel python36-devel \ | ||
&& yum clean all \ | ||
&& rm -rf /var/cache/yum \ | ||
&& ansible-galaxy collection install operator_sdk.util community.kubernetes | ||
&& rm -rf /var/cache/yum | ||
|
||
COPY build/_output/bin/[[.ProjectName]] ${OPERATOR} | ||
COPY bin /usr/local/bin | ||
|
@@ -95,6 +97,10 @@ RUN TINIARCH=$(case $(arch) in x86_64) echo -n amd64 ;; ppc64le) echo -n ppc64el | |
&& curl -L -o /tini https://github.com/krallin/tini/releases/latest/download/tini-$TINIARCH \ | ||
&& chmod +x /tini | ||
|
||
[[- if .Requirements ]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add entry in the changelog over requirements. Is not it a breaking change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part is not a breaking change, but existing users will indeed need to add a requirements file to their existing projects to pull in the |
||
COPY requirements.yml ${HOME}/requirements.yml | ||
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \ | ||
&& chmod -R ug+rwx ${HOME}/.ansible[[ end ]] | ||
[[- if .Watches ]] | ||
COPY watches.yaml ${HOME}/watches.yaml[[ end ]] | ||
[[- if .Roles ]] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2020 The Operator-SDK Authors | ||
// | ||
// Licensed 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 CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ansible | ||
|
||
import ( | ||
"github.com/operator-framework/operator-sdk/internal/scaffold/input" | ||
) | ||
|
||
// RequirementsYml - A requirements file for Ansible collection dependencies | ||
type RequirementsYml struct { | ||
StaticInput | ||
} | ||
|
||
// GetInput - gets the input | ||
func (r *RequirementsYml) GetInput() (input.Input, error) { | ||
if r.Path == "" { | ||
r.Path = "requirements.yml" | ||
} | ||
r.TemplateBody = requirementsYmlTmpl | ||
return r.Input, nil | ||
} | ||
|
||
const requirementsYmlTmpl = `--- | ||
collections: | ||
- name: community.kubernetes | ||
version: "<1.0.0" | ||
- operator_sdk.util | ||
` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
collections: | ||
- community.kubernetes | ||
- operator_sdk.util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add entry in the changelog over the upgrade of openshift version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 done