-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SLING-10229: DockerHub build - using hooks to build and push #27
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# 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 CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# ----------------------------------------------------------------------------- | ||
|
||
# intentionally empty | ||
# DockerHub automatic build needs this file to start |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# ----------------------------------------------------------------------------- | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# 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 CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# ----------------------------------------------------------------------------- | ||
|
||
# we are on ubuntu xenial (16.4) java-11 is hard to install so we tage java 8 | ||
|
||
apt-get update -y | ||
apt-get install default-jdk maven -y | ||
java -version | ||
mvn -version | ||
mvn clean package -P container | ||
|
||
|
||
echo "start docker build" | ||
docker run -i --rm -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn clean package -P container | ||
echo "end docker build" | ||
|
||
# next hook is hook/push |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# ----------------------------------------------------------------------------- | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# 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 CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# ----------------------------------------------------------------------------- | ||
|
||
# tags the maven-generated image with the Docker-Hub estimated image-name:latest and additional tags | ||
|
||
# name of the image, given by pom.xml | ||
BASE_IMAGE_NAME="sling/feature-launcher" | ||
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. Can we use 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. but then the build will only work on the original apache/sling-org-apache-sling-feature-launcher. if you want to fort it an run together with your docherhub account the build will fail |
||
|
||
# latest tag | ||
docker tag $BASE_IMAGE_NAME $DOCKER_REPO:latest | ||
docker push $DOCKER_REPO:latest | ||
|
||
# additional tag with the SHA1 hash of the commit. | ||
docker tag $BASE_IMAGE_NAME $DOCKER_REPO:$SOURCE_COMMIT | ||
docker push $DOCKER_REPO:$SOURCE_COMMIT | ||
|
||
# additional tag with project version, | ||
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
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. Do we need this? I think we could use 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. If we only build on tag thennthia should be enough |
||
docker tag $BASE_IMAGE_NAME $DOCKER_REPO:$PROJECT_VERSION | ||
docker push $DOCKER_REPO:$PROJECT_VERSION | ||
|
||
# additional tag with snapshot or stable | ||
SNAPSHOT_REGEX="^(.*)-SNAPSHOT" | ||
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. No snapshots please 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. ok |
||
if [[ $PROJECT_VERSION =~ $SNAPSHOT_REGEX ]]; | ||
then | ||
docker tag $BASE_IMAGE_NAME $DOCKER_REPO:snapshot | ||
docker push $DOCKER_REPO:snapshot | ||
else | ||
docker tag $BASE_IMAGE_NAME $DOCKER_REPO:stable | ||
docker push $DOCKER_REPO:stable | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,12 +281,8 @@ | |
<configuration> | ||
<images> | ||
<image> | ||
<name>apache/sling-feature-launcher:${project.version}</name> | ||
<name>sling/feature-launcher</name> | ||
<build> | ||
<tags> | ||
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. Shouldn't we keep this for simpler local builds? 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. Sure. |
||
<tag>latest</tag> | ||
<tag>${project.version}</tag> | ||
</tags> | ||
<dockerFileDir>.</dockerFileDir> | ||
<assembly> | ||
<descriptorRef>artifact</descriptorRef> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,18 +23,25 @@ The following command line options are supported: | |
``` | ||
$ rm -rf launcher && java -jar org.apache.sling.feature.launcher.jar -h | ||
usage: launcher | ||
-C <arg> Set artifact clash override | ||
-CC <arg> Set config class override | ||
-c <arg> Set cache dir | ||
-D <arg> Set framework properties | ||
-f <arg> Set feature files (relative and absolute file path or URL including classloader resources) | ||
-p <arg> Set home dir | ||
-u <arg> Set repository url | ||
-V <arg> Set variable value | ||
-ec <arg> Set Extension Configuration (format: extensionName:key1=val1,key2=val2) | ||
-fv <arg> Set Felix Framework version | ||
-fa <arg> Set Framework Artifact (overrides felix framework version) | ||
-v Verbose | ||
-C,--artifact-clash <arg> Set artifact clash override | ||
-c,--cache_dir <arg> Set cache dir | ||
-CC,--config-clash <arg> Set config clash override | ||
-cenv print additional help information | ||
for container env vars. | ||
-D,--framework-properties <arg> Set framework properties | ||
-ec,--extension_configuration <arg> Provide extension configuration, | ||
format: | ||
extensionName:key1=val1,key2=val2 | ||
-f,--feature-files <arg> Set feature files | ||
-fa,--osgi-framework-artifact <arg> Set OSGi framework artifact | ||
(overrides Apache Felix framework | ||
version) | ||
-fv,--felix-framework-version <arg> Set Apache Felix framework version | ||
(default 7.0.0) | ||
-p,--home_dir <arg> Set home dir | ||
-u,--repository-urls <arg> Set repository urls | ||
-V,--variable-values <arg> Set variable values | ||
-v,--verbose <arg> Verbose | ||
``` | ||
|
||
**Note**: if feature files are provided as a Classloader Resource like in an | ||
|
@@ -48,4 +55,36 @@ String[] arguments = new String[] { | |
org.apache.sling.feature.launcher.impl.Main.main(arguments); | ||
``` | ||
|
||
# Container | ||
|
||
The container-image `apache/sling-org-apache-sling-feature-launcher:latest` is avaiable on DockerHub. | ||
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. Please use the new name. 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. isn't that the new name? i am a bit confused. which name do you mean? 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. I meant |
||
|
||
Available tags: | ||
- **latest** - latest build, could be a `snapshot` **or** `release` version. | ||
- **snapshot** - latest build of a `*-SNAPSHOT` version. | ||
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. No snapshots please 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. Ok |
||
- **stable** - latest build of a **release** version. | ||
- **(version)** - latest build of a fixed version, could be a `snapshot - (1.1.9-SNAPSHOT)` **or** `release - (1.1.9)` version. | ||
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. No snapshots please 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. Could you be more explicit. Will we do this only on creating a git tag?
No snapshot! 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. For more context - the ASF release policy says that we only publish releases, not CI artifacts. So for DockerHub, which is a public repository, we should only publish for git tags. A separate discussion is to maybe generate them manually, since after a tag we have a release vote, and only them the publication should happen. So we should have:
I don't think git hash is useful so I would not use that. |
||
- **(sha1)** - uses SHA1 hash of the git commit as tag | ||
|
||
|
||
If you are running sling-feature-launcher as an container please use env vars. | ||
``` | ||
$docker run -it --rm --env FEATURE_FILES=https://path.to/feature-model.json apache/sling-org-apache-sling-feature-launcher:latest | ||
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. Please use the new name. 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. isn't that the new name? i am a bit confused. which name do you mean? 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. I meant |
||
|
||
cli-arg - container ENV variable | ||
------------------------------------- | ||
-C - ARTIFACT_CLASH | ||
-CC - CONFIG_CLASH | ||
-c - CACHE_DIR | ||
-D - FRAMEWORK_PROPERTIES | ||
-f - FEATURE_FILES | ||
-p - HOME_DIR | ||
-u - REPOSITORY_URLS | ||
-V - VARIABLE_VALUES | ||
-ec - EXTENSION_CONFIGURATION | ||
-fv - FELIX_FRAMEWORK_VERSION | ||
-fa - OSGI_FRAMEWORK_ARTIFACT | ||
-v - VERBOSE | ||
``` | ||
|
||
For further documentation see: https://github.com/apache/sling-org-apache-sling-feature/blob/master/readme.md |
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.
Maybe this would be a good place to validate that:
${IMAGE_NAME}
)