tag:blogger.com,1999:blog-71237140963996202262024-03-13T09:49:55.375-07:00moyoy's blogtonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-7123714096399620226.post-38370422535074211152022-03-19T14:12:00.002-07:002022-03-19T14:13:42.358-07:00The Culture Map<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEikPoeeaoyE_TqFF4puypkhojk5hkALn6L3Loy2t63UzpOJnLDX-0DAKFS3EIfwiKd6ZO0nJuXze3pv2IHky_LwLDYHQ2LpPLALiToxXjDgdobNH_K5icIhhzrKMk79fQ-CXnwEW--RpKoKEwr9EwhkoES62ZMpxeY-Zq-sVbGZAwnysArCaOS6yo2IdQ" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="500" data-original-width="500" height="240" src="https://blogger.googleusercontent.com/img/a/AVvXsEikPoeeaoyE_TqFF4puypkhojk5hkALn6L3Loy2t63UzpOJnLDX-0DAKFS3EIfwiKd6ZO0nJuXze3pv2IHky_LwLDYHQ2LpPLALiToxXjDgdobNH_K5icIhhzrKMk79fQ-CXnwEW--RpKoKEwr9EwhkoES62ZMpxeY-Zq-sVbGZAwnysArCaOS6yo2IdQ" width="240" /></a></div><br /><p></p><p><br /></p><ul class="bc-list bc-color-secondary bc-list-nostyle" style="background-color: white; box-sizing: inherit; font-family: "Audible Sans", Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px;"><li class="bc-list-item subtitle bc-spacing-s2 bc-size-medium" style="box-sizing: inherit; font-size: 20px; line-height: 26px; list-style: none; margin-bottom: 16px;">The Culture Map: Breaking Through the Invisible Boundaries of Global Business</li><li class="bc-list-item subtitle bc-spacing-s2 bc-size-medium" style="box-sizing: inherit; font-size: 20px; line-height: 26px; list-style: none; margin-bottom: 16px;">By Erin Meyer</li></ul><div><span color="rgba(20, 20, 20, 0.650980392156863)" face="Audible Sans, Arial, sans-serif"><span style="font-size: 20px;"><br /></span></span></div><div><span color="rgba(20, 20, 20, 0.650980392156863)" face="Audible Sans, Arial, sans-serif"><span style="font-size: 20px;">Este es un libro muy interesante y relevante en IT ya que es común que interactuemos con personas de diferentes culturas; actualmente estoy en un equipo 24/7 distribuido en diferentes países y muchos de los temas explorados en el libro me resultan bastante familiares, me ha ayudado a entender algunos errores míos, la dinámica de un equipo distribuido y también algunas cosas que hemos estado haciendo bien, y sobre todo este libro me ha dado ya varias ideas de como puedo interactuar mejor con mi equipo.</span></span></div><div><br /></div><div><span color="rgba(20, 20, 20, 0.650980392156863)" face="Audible Sans, Arial, sans-serif"><span style="font-size: 20px;"><br /></span></span></div><div><span color="rgba(20, 20, 20, 0.650980392156863)" face="Audible Sans, Arial, sans-serif"><span style="font-size: 20px;">Lectura de Marzo 2022</span></span></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-41851281038816617242022-02-24T19:17:00.005-08:002022-03-19T14:14:03.386-07:00Team Topologies<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjtEIZawN3l7IUaeZo_fkyhnCwMMBxscPTEwp1bAoSUguOOSWVvn3Zc14tlo5WzTOIBUJ1QbK0ZLDB4bpCxoq8f4BRWAoAjv8XrVsfR33zz_RleS6ZiFQetIuIkz2NCFtCjvQUb1LQF_MrWTWvUxBU2GdzZdHbsFs003BaQw8kMdcAZ1qA2XEXBF_hOBg" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="500" data-original-width="500" height="240" src="https://blogger.googleusercontent.com/img/a/AVvXsEjtEIZawN3l7IUaeZo_fkyhnCwMMBxscPTEwp1bAoSUguOOSWVvn3Zc14tlo5WzTOIBUJ1QbK0ZLDB4bpCxoq8f4BRWAoAjv8XrVsfR33zz_RleS6ZiFQetIuIkz2NCFtCjvQUb1LQF_MrWTWvUxBU2GdzZdHbsFs003BaQw8kMdcAZ1qA2XEXBF_hOBg" width="240" /></a></div><p></p><p>Team Topologies: Organizing Business and Technology Teams for Fast Flow</p><p></p><p>By: Matthew Skelton, Manuel Pais</p><p><br /></p><p>Muy buena referencia sobre configuraciones de equipos, me ayudo a darle nombre a dinamicas, patrones, antipatrones e ideas que habia identificado en mi equipo; el libro es recomendable en cualquier etapa de una organizacion ya que puede ayudar a formar equipos y tambien a reorganizarlos para que esten orientados a metas y un optimo flujo de trabajo.</p><p><br /></p><p>Lectura de Febrero 2022</p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-66210993764577951982022-01-03T18:23:00.003-08:002022-01-03T18:23:29.860-08:00tldr pages<p>Esta es una utileria moderna para una actividad clasica, creo que puede ser una categoria en el blog: </p><p><br /></p><p><a href="https://tldr.sh/">tldr.sh</a></p><p>"The tldr pages are a community effort to simplify the beloved man pages with practical examples."</p><p><br /></p><p>Es necesario instalar el Node Package Manager:</p><p><span style="background-color: black; color: white; font-family: courier;">sudo apt-get install npm</span></p><p><br /></p><p>Con eso puedes instalar la aplicacion:</p><p><span style="background-color: black; color: white; font-family: courier;">sudo npm install -g tldr</span></p><div><br /></div><p>Ejemplo:</p><div><span style="background-color: black; color: white;"><span style="font-family: courier;"><b>tony@nuc:~$ tldr ss</b></span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> ss</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> Utility to investigate sockets.<br /></span><span style="font-family: courier;"> More information: https://manned.org/ss.8.</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Show all TCP/UDP/RAW/UNIX sockets:<br /></span><span style="font-family: courier;"> ss -a -t|-u|-w|-x</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Filter TCP sockets by states, only/exclude:<br /></span><span style="font-family: courier;"> ss state/exclude bucket/big/connected/synchronized/...</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Show all TCP sockets connected to the local HTTPS port (443):<br /></span><span style="font-family: courier;"> ss -t src :443</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Show all TCP sockets listening on the local 8080 port:<br /></span><span style="font-family: courier;"> ss -lt src :8080</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Show all TCP sockets along with processes connected to a remote ssh port:<br /></span><span style="font-family: courier;"> ss -pt dst :ssh</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Show all UDP sockets connected on specific source and destination ports:<br /></span><span style="font-family: courier;"> ss -u 'sport == :source_port and dport == :destination_port'</span><span style="font-family: courier;"><br /></span><span style="font-family: courier;"> - Show all TCP IPv4 sockets locally connected on the subnet 192.168.0.0/16:<br /></span><span style="font-family: courier;"> ss -4t src 192.168/16</span></span></div><div style="text-align: left;"><br /></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-32851920556184746732021-10-28T21:59:00.002-07:002021-10-28T21:59:27.820-07:00Java Mug<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-4bYt_ZK9htA/YXt-xxOvilI/AAAAAAAAVNg/alcDVn1dg2w75YVTsGmowZcTPRIAp-QEwCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="2048" data-original-width="1934" height="240" src="https://lh3.googleusercontent.com/-4bYt_ZK9htA/YXt-xxOvilI/AAAAAAAAVNg/alcDVn1dg2w75YVTsGmowZcTPRIAp-QEwCNcBGAsYHQ/image.png" width="227" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;">Tenia tiempo que no encontraba una taza relacionada con la tecnología, esto me recuerda a los tiempos en la universidad donde <u>por elección</u> hacia mis proyectos en java...</div><br /><p></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-20845152609713158222021-09-17T22:21:00.004-07:002021-09-17T22:21:48.865-07:00Comandos Basicos Git<p> Esto es solo una lista de referencia rápida de comandos básicos de git:</p><p>Primero esta el setup inicial:</p><div style="text-align: left;"><span style="font-family: courier;">$ git config --global user.name "Lalo Landa"<br />$ git config --global user.email lalolanda@example.com</span></div><p>Esta información será guardada en el archivo <span style="font-family: courier;">~/.gitconfig</span></p><p><span style="font-family: courier;">$git clone</span></p><p>Este es el comando que te permite clonar en tu maquina un repositorio</p><p><span style="font-family: courier;">$git status</span></p><p>Ver el estatus del directorio actual, este comando te dirá si tienes cambios realizados pero no empujados aun al repositorio. </p><p><span style="font-family: courier;">$git log</span></p><p>Mostrara un listado de los commits mas recientes, su fecha y comentarios</p><p><span style="font-family: courier;">$git show</span></p><p>Te dará detalles del ultimo commit indicando los cambios específicos que se hicieron, se puede ver los detalles de un commit si al comando se le agrega el hash a detallar.</p><p><span style="font-family: courier;">$git commit <file></span></p><p>Es el comando que permite agregar los cambios al repositorio</p><p><span style="font-family: courier;">$git add <file></span></p><p>Permite agregar archivos para que también formen parte del repositorio </p><p><span style="font-family: courier;">$git pull</span></p><p>Este comando sincroniza el repositorio local en base al contenido el repositorio origen</p><p><span style="font-family: courier;">$git push</span></p><p>Con este comando podemos empujar nuestros cambios comprometidos al repositorio remoto</p><p><span style="font-family: courier;">$git stash</span></p><p>Este comando te permite guardar tus cambios locales que después puedes volver a trabajar con git stash pop</p><p><span style="font-family: courier;">$git branch <nombre></span></p><p>Creas un branch del mismo repositorio</p><p><span style="font-family: courier;">$git checkout <branch></span></p><p>Con este comando te cambias al branch donde quieres trabajar</p><p><br /></p><p>Mas información: https://git-scm.com</p><p><br /></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-22132971518275832712021-05-03T19:55:00.003-07:002021-05-03T19:55:43.456-07:00Python Snippets: path, time, datetime<p>Este es un snippet sobre encontrar el archivo mas reciente de un directorio y calcular el tiempo que ha pasado desde su creación, esto es solo la base para una función que busco hacer para un script </p><p><br /></p><div style="background-color: #272822; color: #f8f8f2; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #f92672;">import</span> glob</div><div><span style="color: #f92672;">import</span> os.path</div><div><span style="color: #f92672;">import</span> time</div><div><span style="color: #f92672;">from</span> datetime <span style="color: #f92672;">import</span> datetime</div><br /><div>folder_path <span style="color: #f92672;">=</span> <span style="color: #e6db74;">'D:</span><span style="color: #ae81ff;">\\</span><span style="color: #e6db74;">python</span><span style="color: #ae81ff;">\\</span><span style="color: #e6db74;">doodles</span><span style="color: #ae81ff;">\\</span><span style="color: #e6db74;">'</span></div><div>file_type <span style="color: #f92672;">=</span> <span style="color: #e6db74;">'*.txt'</span></div><div>now <span style="color: #f92672;">=</span> datetime.now()</div><br /><div><span style="color: #88846f;"># get the most recent file from directory</span></div><div>files <span style="color: #f92672;">=</span> glob.glob(folder_path <span style="color: #f92672;">+</span>file_type)</div><div>latest_file <span style="color: #f92672;">=</span> <span style="color: #66d9ef;">max</span>(files, <span style="color: #fd971f; font-style: italic;">key</span><span style="color: #f92672;">=</span>os.path.getctime)</div><br /><div><span style="color: #88846f;"># get the creation time from the most recent file</span></div><div>latest_creation_ctime <span style="color: #f92672;">=</span> os.path.getctime(latest_file)</div><div>latest_creation_time <span style="color: #f92672;">=</span> datetime.fromtimestamp(latest_creation_ctime)</div><br /><div><span style="color: #88846f;"># calculate the diference</span></div><div>duration <span style="color: #f92672;">=</span> now <span style="color: #f92672;">-</span> latest_creation_time</div><div>duration_in_seconds <span style="color: #f92672;">=</span> duration.total_seconds() </div><br /><div><span style="color: #88846f;"># print the number of minutes since the file was created</span></div><div><span style="color: #66d9ef;">print</span>(<span style="color: #66d9ef; font-style: italic;">int</span>(duration_in_seconds)<span style="color: #f92672;">/</span><span style="color: #ae81ff;">60</span>)</div></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-54099806878348314482021-04-21T19:58:00.001-07:002021-04-21T19:58:09.228-07:00Python Snippets - dotenv<p>python-dotenv es una libreria para usar variables de entorno u otra información sensible, este es solo un ejemplo sencillo:</p><p>podemos codificar en base64 cierta información como:</p><div style="text-align: left;"><span style="font-family: courier;">$ echo 'joe' | base64<br />am9lCg==<br />$ echo 'mysecret' | base64<br />bXlzZWNyZXQK</span></div><p>en un archivo llamado <b>.env</b> dejamos lo siguiente :</p><div style="text-align: left;"><span style="font-family: courier;">test_user = "am9lCg=="<br /></span><span style="font-family: courier;">test_secret = "bXlzZWNyZXQK"</span></div><p>Instalamos la librería:</p><div style="text-align: left;"><span style="font-family: courier;">pip install python-dotenv</span></div><p><br /></p><p>Y podemos usarlo de esta forma:</p><div style="background-color: #272822; color: #f8f8f2; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #f92672;">import</span> base64</div><div><span style="color: #f92672;">from</span> dotenv <span style="color: #f92672;">import</span> load_dotenv</div><div><span style="color: #f92672;">import</span> os</div><br /><div>load_dotenv()</div><div>duser <span style="color: #f92672;">=</span> base64.b64decode(os.environ.get(<span style="color: #e6db74;">"test_user"</span>)).decode(<span style="color: #e6db74;">'utf-8'</span>)</div><div>dsecret <span style="color: #f92672;">=</span> base64.b64decode(os.environ.get(<span style="color: #e6db74;">"test_secret"</span>)).decode(<span style="color: #e6db74;">'utf-8'</span>)</div><br /><div><span style="color: #66d9ef;">print</span>(<span style="color: #e6db74;">"Decoded information"</span>)</div><div><span style="color: #66d9ef;">print</span>(duser)</div><div><span style="color: #66d9ef;">print</span>(dsecret)</div></div><p>lo cual entregara como output:</p><div style="text-align: left;"><span style="font-family: courier;">Decoded information<br />joe<br />mysecret</span></div><p><br /></p><p>Esto no es lo mas seguro y para producción u otras situaciones es necesario buscar una alternativa segura.</p><p><br /></p><p> https://pypi.org/project/python-dotenv/</p><p><br /></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-69445938690613496312021-04-12T20:41:00.004-07:002021-04-12T21:39:20.582-07:00Ejemplo sencillo de python con selenium con docker<p> He usado Selenium (https://www.selenium.dev) para interactuar con sitios web, en particular Selenium WebDriver y lo he usado con Python, en el ejemplo de abajo tengo un script solo para sacar el titulo del ultimo post de este blog, para este caso estoy usando chrome junto con el chromedriver los cuales necesitan tener la misma versión.</p><p><span style="color: #2b00fe;">web.py</span></p><div style="text-align: left;"><span style="font-family: courier;">from selenium import webdriver</span></div><div style="text-align: left;"><span style="font-family: courier;"><br /></span><span style="font-family: courier;"># define webdriver options<br /></span><span style="font-family: courier;">options = webdriver.ChromeOptions()<br /></span><span style="font-family: courier;">options.add_argument('--ignore-certificate-errors')<br /></span><span style="font-family: courier;">options.add_argument('--headless')<br /></span><span style="font-family: courier;">options.add_argument('--no-sandbox')<br /></span><span style="font-family: courier;">options.add_argument('--disable-dev-shm-usage')</span></div><div style="text-align: left;"><span style="font-family: courier;"><br /></span><span style="font-family: courier;">driver = webdriver.Chrome(executable_path="/usr/local/bin/chromedriver",options=options)<br /></span><span style="font-family: courier;">driver.get('https://moyoy.blogspot.com')</span></div><div style="text-align: left;"><span style="font-family: courier;"><br /></span><span style="font-family: courier;"># get title of last post based on xpath <br /></span><span style="font-family: courier;">last_post_xpath = '//*[@id="Blog1"]/div[1]/div[1]/div/div/div/h3/a'<br /></span><span style="font-family: courier;">last_post_title = driver.find_element_by_xpath(last_post_xpath).text<br /></span><span style="font-family: courier;">print(last_post_title)<br /></span><span style="font-family: courier;">driver.quit()</span></div><p><br /></p><p>Como esto se puede ejecutar desde una maquina sin interfaz grafica buscaba crear un contenedor para poder estar haciendo pruebas y después poder desplegar una pequeña aplicación que usaría las librerías de Selenium pero me tope con varios problemas hasta que logre crear un contenedor que me pudiera ejecutar el script de arriba</p><p><span style="color: #2b00fe;">Dockerfile</span></p><div style="text-align: left;"><div><span style="font-family: courier;">FROM python:3.8</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"># install google chrome</span></div><div><span style="font-family: courier;">RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -</span></div><div><span style="font-family: courier;">RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'</span></div><div><span style="font-family: courier;">RUN apt-get -y update</span></div><div><span style="font-family: courier;">RUN apt-get install -y google-chrome-stable</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"># install chromedriver</span></div><div><span style="font-family: courier;">RUN apt-get install -yqq unzip</span></div><div><span style="font-family: courier;">RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip</span></div><div><span style="font-family: courier;">RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"># set display port to avoid crash</span></div><div><span style="font-family: courier;">ENV DISPLAY=:99</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"># upgrade pip</span></div><div><span style="font-family: courier;">RUN pip install --upgrade pip</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"># install selenium</span></div><div><span style="font-family: courier;">RUN pip install selenium</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"># add basic script</span></div><div><span style="font-family: courier;">ADD web.py .</span></div><div><span style="font-family: courier;">CMD ["python3", "web.py"]</span></div></div><p><br /></p><p>Con los siguientes comandos construyen el contenedor y después lo ejecutan </p><p><span style="font-family: courier;">$docker build -t selenium-python .</span></p><p><span style="font-family: courier;">$docker run -it selenium-python</span></p><p><span style="font-family: courier;"><br /></span></p><div style="text-align: left;"><span style="background-color: black;"><span style="color: white;"><span style="font-family: courier;">tony@x220:~/docker/selenium-python$ docker run -it selenium-python<br /></span><span style="font-family: courier;">Invocando un pipeline de gitlab a través de la API</span></span></span></div><p><span style="font-family: courier;"></span></p><p><br /></p><p>Dure varias horas buscando la configuración de un contenedor que me funcionara por lo que dejo este ejemplo muy básico aquí en caso de que otra persona tenga el mismo problema.</p><p>Existen algunos cambios recientes en Selenium y en como se define el driver en el código de python, posiblemente haga una actualización sobre ello</p><p><br /></p><p>Gracias a la información en este repo pude resolver algunos de los problemas con los que me encontré:</p><p><a href="https://hub.docker.com/r/joyzoursky/python-chromedriver/">https://hub.docker.com/r/joyzoursky/python-chromedriver/</a></p><p><br /></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-65705224134699215432021-04-07T18:32:00.005-07:002021-04-12T10:54:27.424-07:00Invocando un pipeline de gitlab a través de la API<p>Este es un ejemplo muy sencillo de como ejecutar un pipeline a través del uso de su API sobrescribiendo un valor en de una variable previamente definida</p><p>En esta sección: <span class="na"><b>CI / CD -> Settings -> Variables</b> </span>he definido una variable simple llamada <span style="color: #2b00fe;">GREETING</span> con el valor <span style="color: #2b00fe;">Hola</span></p><p>mi archivo .gitlab-ci.yaml es el siguiente:</p><p><span style="font-family: courier;"><span class="na">image</span><span class="pi">:</span> <span class="s2">"</span><span class="s">tonymoyoy/ubuntu_ansible:v1"</span></span></p><pre class="code highlight" lang="yaml"><span style="font-family: courier;"><span class="line" id="LC2" lang="yaml"></span>
<span class="line" id="LC3" lang="yaml"><span class="na">stages</span><span class="pi">:</span></span>
<span class="line" id="LC4" lang="yaml"> <span class="pi">-</span> <span class="s">build</span></span>
<span class="line" id="LC5" lang="yaml"> <span class="pi">-</span> <span class="s">test</span></span>
<span class="line" id="LC6" lang="yaml"></span>
<span class="line" id="LC7" lang="yaml"><span class="na">build</span><span class="pi">:</span></span>
<span class="line" id="LC8" lang="yaml"> <span class="na">stage</span><span class="pi">:</span> <span class="s">build</span></span>
<span class="line" id="LC9" lang="yaml"> <span class="na">script</span><span class="pi">:</span></span>
<span class="line" id="LC10" lang="yaml"> <span class="pi">-</span> <span class="s">echo $GREETING</span></span>
<span class="line" id="LC11" lang="yaml"> <span class="pi">-</span> <span class="s">echo "Construyendo"</span></span>
<span class="line" id="LC12" lang="yaml"> <span class="pi">-</span> <span class="s">mkdir build</span></span>
<span class="line" id="LC13" lang="yaml"> <span class="pi">-</span> <span class="s">touch build/info2.txt</span></span>
<span class="line" id="LC14" lang="yaml"> <span class="na">artifacts</span><span class="pi">:</span></span>
<span class="line" id="LC15" lang="yaml"> <span class="na">paths</span><span class="pi">:</span></span>
<span class="line" id="LC16" lang="yaml"> <span class="pi">-</span> <span class="s">build/</span></span>
<span class="line" id="LC17" lang="yaml"></span>
<span class="line" id="LC18" lang="yaml"><span class="na">test</span><span class="pi">:</span></span>
<span class="line" id="LC19" lang="yaml"> <span class="na">stage</span><span class="pi">:</span> <span class="s">test</span></span>
<span class="line" id="LC20" lang="yaml"> <span class="na">script</span><span class="pi">:</span></span>
<span class="line" id="LC21" lang="yaml"> <span class="pi">-</span> <span class="s">echo "Probando"</span></span>
<span class="line" id="LC22" lang="yaml"> <span class="pi">-</span> <span class="s">test -f "build/info2.txt"</span></span></span>
</pre><pre class="code highlight" lang="yaml"><span class="line" lang="yaml"><span class="s"><br /></span></span></pre><p style="text-align: left;">En la sección: <b>CI / CD -> Settings -> Pipeline triggers </b>agregue un trigger llamado pew, el cual genera un <b><span style="color: #2b00fe;">Token</span></b></p>Con esto podemos usar curl para iniciar el pipeline, en este caso sobre el branch <b>master</b> y proporcionando el valor <span style="color: #2b00fe;">Hello</span> a la variable <span style="color: #2b00fe;">GREETING</span><div><br /></div><div><br /><span style="background-color: black; color: white;">curl -X POST \<br /> <span> </span>-F token=<YOUR-TRIGGER-TOKEN> \<br /> <span> </span>-F "ref=master" \<br /> <span> </span>-F "variables[GREETING]=Hello" \<br /> http://<YOURGITLAB>/api/v4/projects/4/trigger/pipeline</span><p style="text-align: left;"><br /></p><p style="text-align: left;">En el log del pipeline podremos ver que tomo el valor de la variable:</p><p style="text-align: left;"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-JqZx6I9ariQ/YG5cmPk7n6I/AAAAAAAATr4/PpH6HnmY4mcamAMU3xlXUCMHzSOecyr5gCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="141" data-original-width="465" height="97" src="https://lh3.googleusercontent.com/-JqZx6I9ariQ/YG5cmPk7n6I/AAAAAAAATr4/PpH6HnmY4mcamAMU3xlXUCMHzSOecyr5gCNcBGAsYHQ/image.png" width="320" /></a></div><br /><br /><p></p></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-21909476264027004582021-04-05T20:43:00.004-07:002021-04-05T20:43:47.539-07:00NCurses Disk Usage<p> Me tope con esta herramienta para análisis de espacio en disco: <b>ncdu</b></p><p>Comúnmente se usa el comando du pero esta herramienta facilita mucho la búsqueda de los directorios y archivos que están consumiendo gran parte de nuestro espacio.</p><p><span style="background-color: white; color: #222222; font-family: Georgia, Verdana, serif; font-size: 16px;"><i>Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a remote server where you don't have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to run in any minimal POSIX-like environment with ncurses installed.</i></span></p><p><a href="https://dev.yorhel.nl/ncdu">https://dev.yorhel.nl/ncdu</a></p><p></p><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-Cgv3tdipw0E/YGvYyp0AV2I/AAAAAAAATrk/jTBKpc90zMEd91-wuxmCgYF4YHYWEJx_QCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="968" data-original-width="814" height="240" src="https://lh3.googleusercontent.com/-Cgv3tdipw0E/YGvYyp0AV2I/AAAAAAAATrk/jTBKpc90zMEd91-wuxmCgYF4YHYWEJx_QCNcBGAsYHQ/image.png" width="202" /></a></div><br /><br /><p></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-31268784785700124042021-04-03T13:21:00.002-07:002021-04-03T13:21:29.857-07:00IBM Thinkpad Mug<p> </p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-kH9_KAEJCsY/YGjOJA5orlI/AAAAAAAATrQ/RQ5FCEugtkoyMltABCnYZz0xRYTP3g-rgCNcBGAsYHQ/s2048/ibm-thinkpad%2Bmug.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="2048" data-original-width="2048" height="320" src="https://1.bp.blogspot.com/-kH9_KAEJCsY/YGjOJA5orlI/AAAAAAAATrQ/RQ5FCEugtkoyMltABCnYZz0xRYTP3g-rgCNcBGAsYHQ/s320/ibm-thinkpad%2Bmug.jpg" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><p></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-53089597740725668132021-03-27T20:39:00.001-07:002021-03-27T20:39:32.605-07:00Probando Ansible Playbook en un Docker Container con Gitlab<p> Estoy probando ansible y quería tener un setup sencillo para que gitlab hiciera pruebas del código en un contenedor de docker a través de un pipeline, por el momento aquí dejo algo sencillo, tengo este playbook:</p><p><br /></p><p>simple_playbook.yml</p><pre class="code highlight" lang="yaml"><span style="font-family: courier;"><span class="line" id="LC1" lang="yaml">---</span>
<span class="line" id="LC2" lang="yaml"><span class="pi">-</span> <span class="na">hosts</span><span class="pi">:</span> <span class="s">all</span></span>
<span class="line" id="LC3" lang="yaml"> <b><span class="na">connection</span><span class="pi">:</span> <span class="s">local</span></b></span>
<span class="line" id="LC4" lang="yaml"> <span class="na">tasks</span><span class="pi">:</span></span>
<span class="line" id="LC5" lang="yaml"> <span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">curl instalation</span></span>
<span class="line" id="LC6" lang="yaml"> <span class="na">apt</span><span class="pi">:</span> <span class="s">pkg=curl update_cache=yes</span></span></span>
</pre><pre class="code highlight" lang="yaml"><span style="font-family: courier;"><span class="line" lang="yaml"><span class="s"><br /></span></span></span></pre><p style="text-align: left;"><span style="font-family: inherit;">La </span>conexión<span style="font-family: inherit;"> es local para ya que no es necesario trabajar con llaves ssh al estar aplicando las pruebas al contendor cada vez.</span></p><p style="text-align: left;"><span style="font-family: inherit;">el archivo .gitlab-ci.yml es el siguiente:</span></p><pre class="code highlight" lang="yaml"><span style="font-family: courier;"><span class="line" id="LC1" lang="yaml"><span class="na">image</span><span class="pi">:</span> <span class="s2">"</span><span class="s">tonymoyoy/ubuntu_ansible:v2"</span></span>
<span class="line" id="LC2" lang="yaml"></span>
<span class="line" id="LC3" lang="yaml"><span class="na">stages</span><span class="pi">:</span></span>
<span class="line" id="LC4" lang="yaml"> <span class="pi">-</span> <span class="s">build</span></span>
<span class="line" id="LC5" lang="yaml"> <span class="pi">-</span> <span class="s">test</span></span>
<span class="line" id="LC6" lang="yaml"></span>
<span class="line" id="LC7" lang="yaml"><span class="na">build</span><span class="pi">:</span></span>
<span class="line" id="LC8" lang="yaml"> <span class="na">stage</span><span class="pi">:</span> <span class="s">build</span></span>
<span class="line" id="LC9" lang="yaml"> <span class="na">script</span><span class="pi">:</span></span>
<span class="line" id="LC10" lang="yaml"> <b><span class="pi">-</span> <span class="s">echo $HOSTNAME > hosts</span></b></span>
<span class="line" id="LC11" lang="yaml"> <span class="pi">-</span> <span class="s">echo "Running ansible playbook"</span></span>
<span class="line" id="LC12" lang="yaml"> <span class="pi">-</span> <span class="s">ansible-playbook <b>-i hosts</b> local-playbook.yml</span></span>
<span class="line" id="LC13" lang="yaml"></span>
<span class="line" id="LC14" lang="yaml"><span class="na">test</span><span class="pi">:</span></span>
<span class="line" id="LC15" lang="yaml"> <span class="na">stage</span><span class="pi">:</span> <span class="s">test</span></span>
<span class="line" id="LC16" lang="yaml"> <span class="na">script</span><span class="pi">:</span></span>
<span class="line" id="LC17" lang="yaml"> <span class="pi">-</span> <span class="s">echo "Test pending"</span></span></span>
</pre><p style="text-align: left;">La forma que logre que se ejecutara en el contenedor fue agregando el <i>hostname</i> a un archivo y luego haciendo referencia al archivo hosts como variable del comando <i>ansible-playbook</i></p><p style="text-align: left;">En este caso use la variable HOSTNAME de gitlab-ci (ver <a href="https://docs.gitlab.com/ee/ci/variables/">https://docs.gitlab.com/ee/ci/variables/</a>) aunque también pude simplemente usar el comando <i>hostname</i> y enviar el resultado a el archivo, intente hacer la llamada después del comando <i>ansible-playbook</i> pero no encontré una forma de hacerlo funcionar.</p><p style="text-align: left;">Espero que este material puede servir de referencia para alguien</p><p style="text-align: left;"><br /></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-65369222050285717792021-03-23T20:52:00.009-07:002021-03-27T20:23:01.675-07:00Creación de Imagen simple de Docker <p> Requisitos: Tener cuenta en https://hub.docker.com</p><p><br /></p><p>En tu maquina con docker previamente instalado crea en una carpeta de tu elección un archivo </p><p><span style="font-family: courier;">touch Dockerfile</span></p><p><span style="font-family: courier;">vim Dockerfile</span></p><p>Incluye instrucciones como la imagen base (ubuntu) quien mantiene la imagen creada y en este caso un par de instrucciones para actualizar el sistema operativo e instalar ansible.</p><p><span style="font-family: courier;">FROM ubuntu</span></p><p><span style="font-family: courier;">MAINTAINER tonymoyoy</span></p><p><span style="font-family: courier;">RUN apt-get update -y</span></p><p><span style="font-family: courier;">RUN apt-get install ansible -y</span></p><p><span style="font-family: inherit;">Una vez creado y guardado el archivo, construye la imagen con el comando build, con -t le pongo un tag y el punto hace referencia a que el Dockerfile esta en el directorio de donde estoy corriendo el comando</span></p><p><span style="font-family: courier;">docker build -t ubuntu_ansible .</span></p><p><span style="font-family: courier;"><br /></span></p><p><span style="font-family: inherit;">Una vez creada la imagen la debes poder ver con el comando</span></p><p><br /></p><p><span style="font-family: courier;">tony@x220:~/docker/ansible$ docker images</span></p><p><span style="font-family: courier;">REPOSITORY TAG IMAGE ID CREATED SIZE</span></p><p></p><p><span style="font-family: courier;">ubuntu_ansible latest 7988920ab754 8 seconds ago 300MB</span></p><p>Para subirla a docker hub es necesario hacer login con:</p><p><span style="font-family: courier;">docker login</span></p><p>Utiliza tus credenciales de docker hub.</p><p>Ahora vuelve a tagear la imagen en este caso referenciada por si ID con un formato como el siguiente:</p><p><span style="font-family: courier;">docker tag 7988920ab754 tonymoyoy/ubuntu_ansible:v1</span></p><p>Y con el siguiente comando puedes subir la image an docker hub:</p><p><span style="font-family: courier;">docker push tonymoyoy/ubuntu_ansible:v1</span></p><p><span style="font-family: inherit;">Y listo, la debes de poder ver desde tu cuenta de docker hub</span></p><p><span style="font-family: courier;"><br /></span></p><p><span style="font-family: courier;"><br /></span></p><p><span style="font-family: courier;"><br /></span></p>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-87991308169044413972021-03-21T13:58:00.007-07:002021-03-21T14:00:31.873-07:00Instalacion de Gitlab (Community Edition) en Ubuntu 20.04<p>Recientemente instale Gitlab en una maquina personal con la finalidad de hacer algunas pruebas, me tope con varios problemas y decidí documentar como al final lo instale y cree un pipeline sencillo.</p><p>Varios de los problemas con los que me tope eran derivados de la validez del certificado que se intenta generar en la instalación de Gitlab y del dominio de DNS, si tienes un dominio valido y quieres utilizar un certificado puedes hacerlo, la instalación de Gitlab intentara crear uno con letsencrypt, <u>pero para este caso no usare un certificado o un dominio.</u></p><p><br /></p><p>Las instrucciones para la instalación de Gitlab Community Edition se encuentran aquí:</p><p><span style="font-family: inherit;"><i>https://about.gitlab.com/install/?version=<b>ce</b>#ubuntu</i></span></p><p><br /></p><p><span style="font-family: courier;">sudo apt-get install -y curl openssh-server ca-certificates tzdata perl</span></p><p>Es opcional instalar y configurar el correo:</p><div><span style="font-family: courier;">sudo apt-get install -y postfix</span></div><div><br /></div><div>Con la siguiente instrucción puedes instalar Gitlab y definir el URL, en las instrucciones de Gitlab aconseja usar un dominio valido y el protocolo https, pero para fines de pruebas lo haremos con http y usare la dirección IP del servidor, (usa la ip de tu servidor)</div><div><br /></div><div><div><span style="font-family: courier;">sudo EXTERNAL_URL="http://<i>192.168.1.210</i>" apt-get install gitlab-<b>ce</b></span></div></div><div><br /></div><div>Igual esto se puede cambiar después desde el archivo:</div><div><br /></div><div><span style="font-family: courier;">/etc/gitlab/gitlab.rb</span></div><div><br /></div><div>Editando el parametro <span style="font-family: courier;">external_url</span> y reconfigurando gitlab:</div><div><br /></div><div><span style="font-family: courier;">sudo gitlab-ctl reconfigure</span></div><div><br /></div><div><br /></div><div>Con esto deberás tener tu servicio corriendo y puedes ir a http://localhost (o la ip de tu servidor) desde tu navegador web y tendrás que definir un password de root para Gitlab con el cual podrás administrar la aplicación</div><div><br /></div><div>Para registrar un nuevo usuario puedes hacer logout del usuario root para volver a la pagina de login y ahí esta el botón de Register Now:</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-Ow0chwLUkbo/YFeneyU6lwI/AAAAAAAATkA/3pv6y-w-NeU5YHtuT3SiClwnDgh27pbGQCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="392" data-original-width="487" height="240" src="https://lh3.googleusercontent.com/-Ow0chwLUkbo/YFeneyU6lwI/AAAAAAAATkA/3pv6y-w-NeU5YHtuT3SiClwnDgh27pbGQCNcBGAsYHQ/image.png" width="298" /></a></div><br /></div><div><br /></div><div>Por default los nuevos usuarios que se registren tienen que ser aprobados así que entras de nuevo como el usuario root </div><div><br /></div><div><span style="font-family: courier;">Admin Area -> Users </span></div><div><br /></div><div>En esa sección encontraras un apartado llamado <span style="font-family: courier;">Pending Approval</span> y ahí tienes la acción para aprobar al usuario recién creado </div><div><br /></div><div>El usuario nuevo ahora podrá hacer login, y al ser la primera vez que este usuario esta entrando pedirá que te asignes un rol:</div><div><br /></div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-DZ4bf8EqxMk/YFeogumEkeI/AAAAAAAATkI/1isQUuSVvVIP_e0Wh2Op-MBqSDKbgD1ZwCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="446" data-original-width="687" height="208" src="https://lh3.googleusercontent.com/-DZ4bf8EqxMk/YFeogumEkeI/AAAAAAAATkI/1isQUuSVvVIP_e0Wh2Op-MBqSDKbgD1ZwCNcBGAsYHQ/image.png" width="320" /></a></div><br /><br /></div><div><br /></div><div>Una de las primeras cosas a realizar es agregar tu llave publica de SSH de la maquina donde estarías trabajando, esto lo puedes hacer en:</div><div><br /></div><div><span style="font-family: courier;">User Settings -> SSH Keys</span></div><div><br /></div><div><br /></div><div>En caso de no tener una, usar el comando <span style="font-family: courier;">ssh-keygen</span></div><div><br /></div><div>Al menos de que elijas otra localidad tu llave publica se encontrara en <span style="font-family: courier;">/home/usuario/.ssh/id_rsa.pub</span></div><div><br /></div><div><br /></div><div>Crea un nuevo Proyecto para comprobar la funcionalidad, elige <b>Initialize repository with a README</b></div><div>para que el repositorio no este vacío.</div><div><br /></div><div>Una vez creado el proyecto veras un botón Clone con la dirección para clonar el repositorio, si tu <span style="font-family: courier;">external_url </span>es un dominio la dirección que veras aquí será en base a esa información, en mi caso estoy usando la dirección IP.</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-p2LM7GOPhfs/YFeplGmF0OI/AAAAAAAATkQ/3cDQaFsj0204fED1YsAHsaB1joP7qR40wCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="361" data-original-width="520" height="222" src="https://lh3.googleusercontent.com/-p2LM7GOPhfs/YFeplGmF0OI/AAAAAAAATkQ/3cDQaFsj0204fED1YsAHsaB1joP7qR40wCNcBGAsYHQ/image.png" width="320" /></a></div><br /><br /></div><div>Desde tu maquina de trabajo clona el repositorio:</div><div><br /></div><div><span style="font-family: courier;">git clone git@192.168.1.220:jesus/ansible-hello2.git</span></div><div><br /></div><div>Y crea estos tres archivos o una versión similar, yo aquí tengo la referencia a una maquina en mi red con la ip 192.168.1.210 a la cual entro con el usuario a6 y del cual tengo configuradas llaves de ssh, para fines prácticos este código no se usara en el pipeline aun.</div><div><br /></div><div>hosts</div><blockquote><div><span style="font-family: courier;">192.168.1.210 ansible_user=a6</span></div></blockquote><div>ping-playbook.yml</div><blockquote><div><div><span style="font-family: courier;">---</span></div><div><span style="font-family: courier;">- hosts: all</span></div><div><span style="font-family: courier;"> remote_user: a6</span></div><div><span style="font-family: courier;"> tasks:</span></div><div><span style="font-family: courier;"> - name: ping server</span></div><div><span style="font-family: courier;"> ping:</span></div></div></blockquote><div><b>.</b>gitlab-ci.yml</div><blockquote><div><div><span style="font-family: courier;">build-job:</span></div><div><span style="font-family: courier;"> stage: build</span></div><div><span style="font-family: courier;"> script:</span></div><div><span style="font-family: courier;"> - echo "Hello There!"</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;">test-job1:</span></div><div><span style="font-family: courier;"> stage: test</span></div><div><span style="font-family: courier;"> script:</span></div><div><span style="font-family: courier;"> - echo "This job tests something"</span></div></div></blockquote><div><div><br /></div><div>Empuja estos nuevos archivos a tu repositorio en Gitlab</div><div><br /></div><div><span style="font-family: courier;">git add hosts ping-playbook.yml .gitlab-ci.yml</span></div><div><span style="font-family: courier;">git commit -a</span></div><div><span style="font-family: courier;">git push</span></div></div><div><br /></div><div>Los archivos <b>hosts</b> y <b>ping-playbook.yml</b> son parte un playbook de ansible muy simple, y el archivo <b>.gitlab-ci.yml </b>es un pipeline que solo manda unos mensajes, a continuación haremos el setup simplemente para que el pipeline se ejecute por los runners, configuraremos uno con docker.</div><div><br /></div><div><br /></div><div><br /></div><div>Es necesario instalar docker</div><div><br /></div><div><span style="font-family: courier;">sudo apt-get install docker.io</span></div><div><br /></div><div><br /></div><div>Prueba que docker este funcionando:</div><div><br /></div><div><span style="font-family: courier;">sudo usermod -aG docker <i>nombredetuusuario</i></span></div><div><br /></div><div>Ejecuta un docker de prueba:</div><div><br /></div><div><span style="font-family: courier;">docker run hello-world</span></div><div><br /></div><div><br /></div><div>Ya que tengas docker instalado, instala lo siguiente gitlab-runner, los runners son los encargados de correr los Jobs de los pipelines, puedes tener distintos tipo, para este caso usaremos uno basado en docker.</div><div><br /></div><div><span style="font-family: courier;"> sudo apt-get install gitlab-runner</span></div><div><br /></div><div><br /></div><div>De regreso a Gitlab, ve a tu proyecto</div><div><br /></div><div><span style="font-family: courier;">Settings -> CI/CD -> Runners</span></div><div><br /></div><div>En esa sección encontraras las instrucciones para instalar y registrar un runner en:</div><div><br /></div><div><b>Show Runner Installation Instructions</b></div><div><b><br /></b></div><div>Veras algo como:</div><div><br /></div><div><span style="font-family: courier;">sudo gitlab-runner register --url http://192.168.1.220/ --registration-token JKuz82V6zA2maiaYsLs</span></div><div><span style="font-family: courier;"><br /></span></div><div>De nuevo puedes ver que estoy usando http y no https y la ip en lugar de un dominio, el registration token en tu caso será diferente así como la ip de tu servidor</div><div><br /></div><div>Entre las preguntas que necesitas contestar están las siguientes:</div><div><br /></div><div><div><span style="font-family: courier;">Please enter the executor: docker+machine, kubernetes, docker-ssh, parallels, shell, ssh, virtualbox, docker, docker-ssh+machine:</span></div><div><span style="font-family: courier;"><b>docker</b></span></div><div><span style="font-family: courier;">Please enter the default Docker image (e.g. ruby:2.1):</span></div><div><span style="font-family: courier;"><b>ubuntu:latest</b></span></div><div><span style="font-family: courier;">Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!</span></div></div><div><br /></div><div>De regreso a </div><div><br /></div><div><span style="font-family: courier;">Settings -> CI/CD -> Runners</span></div><div><br /></div><div>Podrás ver los runners que tienes registrados</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-QIZSP0Ea5s8/YFeuVxFUv3I/AAAAAAAATkY/BkIM7-D5jOwXB_bEyJWVaGV0sA6ZfgUYACNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="255" data-original-width="615" height="133" src="https://lh3.googleusercontent.com/-QIZSP0Ea5s8/YFeuVxFUv3I/AAAAAAAATkY/BkIM7-D5jOwXB_bEyJWVaGV0sA6ZfgUYACNcBGAsYHQ/image.png" width="320" /></a></div><br />En este punto es posible que el pipeline se intente ejecutar o lo puedes ejecutar desde </div><div><br /></div><div><span style="font-family: courier;">CI/CD -> Pipeline - Run Pipeline</span></div><div><br /></div><div>Pero es posible que el pipeline falle porque no lo tome el runner:</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-r7GCC-LLoL4/YFewMlchadI/AAAAAAAATkg/zgJvxJ_R4Pc4_p7omL2hdMyJi8UlXd3LwCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="602" data-original-width="1141" height="169" src="https://lh3.googleusercontent.com/-r7GCC-LLoL4/YFewMlchadI/AAAAAAAATkg/zgJvxJ_R4Pc4_p7omL2hdMyJi8UlXd3LwCNcBGAsYHQ/image.png" width="320" /></a></div><br /><br /></div><div><br /></div><div> en mi caso no tenia la imagen de docker necesaria e intente descargarla aunque tuve el siguiente error:</div><div><br /></div><div><br /></div><div><div><span style="font-family: courier;">tony@x220:~$ docker pull gitlab/gitlab-runner-helper</span></div><div><span style="font-family: courier;">Using default tag: latest</span></div><div><span style="font-family: courier;">Error response from daemon: manifest for gitlab/gitlab-runner-helper:latest not found: manifest unknown: manifest unknown</span></div></div><div><br /></div><div>Encontre que alguien la pudo descargar de la siguiente forma</div><div><br /></div><div><div><span style="font-family: courier;">tony@x220:~$ docker run --rm -it gitlab/gitlab-runner-helper:x86_64-6d9dd510</span></div><div><span style="font-family: courier;">Unable to find image 'gitlab/gitlab-runner-helper:x86_64-6d9dd510' locally</span></div><div><span style="font-family: courier;">x86_64-6d9dd510: Pulling from gitlab/gitlab-runner-helper</span></div><div><span style="font-family: courier;">614f111fed99: Pull complete</span></div><div><span style="font-family: courier;">Digest: sha256:2731a347dfb90e2a93a63a9d5f61ee19860ebb6cfeb1258ffaf8fb7afae33133</span></div><div><span style="font-family: courier;">Status: Downloaded newer image for gitlab/gitlab-runner-helper:x86_64-6d9dd510</span></div><div><span style="font-family: courier;">docker: Error response from daemon: No command specified.</span></div><div><span style="font-family: courier;">See 'docker run --help'.</span></div><div><span style="font-family: courier;">tony@x220:~$ docker tag gitlab/gitlab-runner-helper:x86_64-6d9dd510 gitlab-runner-helper:11.2.0</span></div><div><span style="font-family: courier;">tony@x220:~$</span></div></div><div><br /></div><div><br /></div><div>Ahora que tienes la imagen del contenedor necesaria ve de nuevo a tu pipeline y intenta correr el Job atorado: <span style="font-family: courier;">Retry This Job</span></div><div><br /></div><div><br /></div><div>Aquí Gitlab pudo tomar la configuración de .gitlab-ci.yml y ejecutar las instrucciones:</div><div><br /></div><div><br /></div><div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-UE9VRxGelVQ/YFewe8CpedI/AAAAAAAATko/bhvImCvsPJw7Tg-poj2huY6omjfzA9qOwCNcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="531" data-original-width="1196" height="142" src="https://lh3.googleusercontent.com/-UE9VRxGelVQ/YFewe8CpedI/AAAAAAAATko/bhvImCvsPJw7Tg-poj2huY6omjfzA9qOwCNcBGAsYHQ/image.png" width="320" /></a></div></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div><br /></div><div><br /></div><div>En una segunda parte de este tema incluiré in pipeline que pruebe el código de ansible y otro que la aplique a algún host</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-17220490382649407862020-08-06T21:10:00.004-07:002020-08-06T21:10:55.653-07:00Z & The Firemen's Ball<div>Recientemente pude avanzar un poco en el <i>backlog</i> de películas que tengo pero que no he visto, uno de mis hobbies es comprar DVDs de segunda mano en los sobre ruedas, no compro todo solo películas que ya vi que me gustan, clásicos de edición especial y cualquier que sea de The Criterion Collection.</div><div><br /></div><div><b>The Firemen's Ball</b></div><div>Dir. Milos Forman</div><div>1967</div><div><br /></div><div>Es una comedia que gira alrededor de un evento en el departamento de bomberos hay un concurso de belleza, rifas y un antiguo jefe de bomberos recibira un reconocimiento pero todo sale mal, aunque una comedia checoslovaquia es muy diferente a lo que estamos acostumbrados a ver en la actualidad pero verla desde el contexto en el cual fue realizada es interesante pues en su momento se considero una sátira al partido comunista sin mencionarlo directamente y eso sirve como una excusa para mirar The Firemen's Ball y la misma sátira puede aplicar en la actualidad.</div><div><br /></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><img border="0" data-original-height="1600" data-original-width="1288" height="320" src="https://1.bp.blogspot.com/-Q0IR1a5eFXI/XxxIUlTzzgI/AAAAAAAARjM/D-j2YFNCRtcejoi6PR78LFkaxmpik83XwCNcBGAsYHQ/s320/fireman.jpg" style="text-align: left;" /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;"><b>Z</b></div><div class="separator" style="clear: both; text-align: left;">Dir. Costa-Gavras</div><div class="separator" style="clear: both; text-align: left;">1969</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Z es un thriller que recrea en forma de ficcion eventos reales sobre el asesinato de un político griego en 1963, esta película es muy accesible su edición y musicalización son memorables y el manejo tema es algo que quisiera ver mas en películas de la actualidad pues no trata de esconder de que se está hablando sin embargo no se inclina hacia una temática de políticos de derecha vs politicos de izquierda ni es una biografía del político asesinado, simplemente narra hechos y vemos la corrupción en el ser humano. </div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-xN9cMdTYxyU/XxxISjhm4vI/AAAAAAAARjI/zTB_4MVgvAo5Dal-zl-kRCPVjOqxINUYwCNcBGAsYHQ/s1600/z.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1288" height="320" src="https://1.bp.blogspot.com/-xN9cMdTYxyU/XxxISjhm4vI/AAAAAAAARjI/zTB_4MVgvAo5Dal-zl-kRCPVjOqxINUYwCNcBGAsYHQ/s320/z.jpg" /></a></div><br /><div><br /></div><div><br /></div><div>Ambas películas fueron un <i>blind buy</i> (es decir, no se nada de estas cintas) y las tuve por más de un año hasta que me di el tiempo de verlas, y ambas fueron una sorpresa agradable aunque desagradablemente uno puede ver que el mundo aún no ha cambiado mucho en los últimos 50 años.</div><div><br /></div><div><br /></div><div>En esta pandemia del COVID-19 me he refugiado en películas de los 90's y 80's y quise ir mas atrás pero por alguna razón vi muchos reflejos de situaciones actuales, creo que me quedaré en el escapismo de otras décadas </div><div><br /></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-59916396221793589662020-07-18T15:32:00.001-07:002020-07-18T15:32:42.743-07:00python zip functionNo me he dedicado a programar de tiempo completo pero me he mantenido activo con algunos proyectos personales, hace poco realice un script para el trabajo el cual funcionó bien aunque algunas partes no eran muy buenas.<div><br /></div><div>Un ejemplo es una iteración como esta:</div><div><br /></div><div><div style="background-color: #272822; color: #f8f8f2; font-family: "droid sans mono", monospace, monospace, "droid sans fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>movies <span style="color: #f92672;">=</span> [<span style="color: #e6db74;">'The Abyss'</span>, <span style="color: #e6db74;">'Big'</span>, <span style="color: #e6db74;">'The Prestige'</span>, <span style="color: #e6db74;">'Boyhood'</span>, <span style="color: #e6db74;">'Brick'</span>]</div><div>years <span style="color: #f92672;">=</span> [<span style="color: #ae81ff;">1989</span>,<span style="color: #ae81ff;">1988</span>,<span style="color: #ae81ff;">2006</span>,<span style="color: #ae81ff;">2014</span>,<span style="color: #ae81ff;">2005</span>]</div><br /><div><span style="color: #88846f;"># ugly iteration</span></div><div><span style="color: #f92672;">for</span> movie <span style="color: #f92672;">in</span> <span style="color: #66d9ef;">range</span>(<span style="color: #66d9ef;">len</span>(movies)):</div><div> <span style="color: #66d9ef;">print</span>(<span style="color: #66d9ef; font-style: italic;">str</span>(movies[movie]) <span style="color: #f92672;">+</span> <span style="color: #e6db74;">" - "</span> <span style="color: #f92672;">+</span> <span style="color: #66d9ef; font-style: italic;">str</span>(years[movie]))</div></div></div><div><br /></div><div>Necesitaba recorrer dos listas a mismo tiempo y generar información en otra lista en el mismo índice, aunque el ciclo funciona el codigo es feo</div><div><br /></div><div><br /></div><div>Despues encontre la función zip la cual permite hacer una iteración paralela, el ciclo puede quedar de esta forma:</div><div><br /></div><div><div style="background-color: #272822; color: #f8f8f2; font-family: "droid sans mono", monospace, monospace, "droid sans fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #f92672;">for</span> movie, year <span style="color: #f92672;">in</span> <span style="color: #66d9ef;">zip</span>(movies, years):</div><div> <span style="color: #66d9ef;">print</span>(<span style="color: #66d9ef; font-style: italic;">str</span>(movie) <span style="color: #f92672;">+</span> <span style="color: #e6db74;">" - "</span> <span style="color: #f92672;">+</span> <span style="color: #66d9ef; font-style: italic;">str</span>(year))</div></div></div><div><br /></div><div><br /></div><div>lo cual es mas claro y el resultado es el mismo.</div><div><br /></div><div><br /></div><div><a href="https://realpython.com/python-zip-function/">https://realpython.com/python-zip-function/</a></div>tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0tag:blogger.com,1999:blog-7123714096399620226.post-71696204831336287552012-07-15T21:30:00.000-07:002018-05-18T19:53:44.698-07:00IBM Mugs<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-mHKHkOk9W9I/UAOYhCC1v4I/AAAAAAAABa4/4kM-tk2Seys/s1600/musf.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="134" src="https://2.bp.blogspot.com/-mHKHkOk9W9I/UAOYhCC1v4I/AAAAAAAABa4/4kM-tk2Seys/s320/musf.jpg" width="320" /></a></div>
<br />tonymoyoyhttp://www.blogger.com/profile/17432505654838124996noreply@blogger.com0