rh-openstack-ci-team
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # container-copy ###### tags: `Design` ## Introduction Copy container was a tool initially created to sync tripleo containers between docker and quay.io once docker started to enforce the daily quota of containers. Since then, some solutions were created to avoid these quota, like the container provider job. The tool initially was supposed to just copy the containers from docker and rdo to quay. Initially was created in python, using podman v2 rest api, however, due to some limitagions (only worked on podman > 2.6) and because it had to have podman rest api running all the time, and doesn't remove the fact that it was required to prune all the containers locally after it finishes. Another sollution was base the code on the skopeo, that is based on the podman api. This way, the copy of containers is today made in golang code, using the same podman api available on podman. ### Why do I care Quay today is used as alternative to docker, and since the promotion right now doesn't copy the promoted containers to quay.io, this is required to keep everything in sync. ### When would I look here When something goes wrong, like for example, when the containers tagged as current-tripleo are too old compared to docker and rdo registries. ### What this does The copy container check for the job the latest successfull job that build the containers for the list of containers builded, than get the hash code for those containers, and copy from registry.trunk.rdoproject.org to quay.io. This happens every two hours via cron job on the toolbox. At this point, doesn't matter if the container is promoted or not, it will copy whatever is available at the moment. If the latest job was already coppied, the tool is smart (well, podman is smart enough) to point that the layers already exist, and it will just keep skipping for the next layer, which make the copy quick, and no need to checks if the container already exists on quay or not. So, you don't need to care to check if the container exist or not before copy it. After that, another cron job, tag the container with the current-tripleo tag. This is not related to podman it self. The tool check the (several different endpoints for each release) api from DLRN to get the latest current-tripleo tag, and using quay.io api, tag each container. ### Where it is Right now, this is running in our toolbox machine that can be accessed via ssh on 38.102.83.131. The logs are available on /root/logs locally, and on the web on http://38.102.83.131/quay/ and http://38.102.83.131/quay/tag The binary and scripts of cronjob are available right now on /root/copy-quay directory, but soon we will have a dedicated ansible role to deploy it. ### How often it runs As mentioned before, it runs every 2 hours both the copy, and the tag. ## Toolbox ### Where the code is Right now the code is available on /root/copy-quay on the toolbox, but it will also be available on [ci-config](https://github.com/rdo-infra/ci-config) repository once https://review.rdoproject.org/r/c/rdo-infra/ci-config/+/32938 get merged. ### Deployed and how The code is on /root/copy-quay, together with the shell script with the call for each release. You can edit the go file for changes and run go build to compile it. It might require some packages, but this is already installed in the toolbox machine, and it's also listed in the patch with the ansible task. ### Log structure There are four different logs, the logs on /root/logs/release.txt (master, wallaby, victorya, etc) are the logs from the tool running and copying containers. There is also the /root/logs/release-report.html that is the report for the latest time the tool was executed and copied container. As you can notice in the report, it shows all the containers that were executed with the date, the hash and the status for each container, if it was coppied successfully or failed. Also, under /root/logs/tag you have the same structure but for tagging. The copy and tag of containers are splited although it is done by the same tool. ## User workflow - Copy containers ### Container failing to copy The first step is check the release-report.hml (where release is master, wallaby, etc) and see the latest hash, and the failing container. After that, search in the /root/logs/release.txt (where release is the same as in release-report.html) and check the reason of failure. If the failure was related to some timeout, you can either manually run the copy tool to copy only the failing container, or wait for the next run and check if it will still fail. Of course, wait for the next run might copy a different hash since in this time window, a new hash might be built. Let's get an example, you check http://38.102.83.131/quay/master-report.html and notice that the container openstack-designate-worker with hash ec48e22f7ecb7ab5150d08a942860b22_x86_64 fail. At this point, the next step is check http://38.102.83.131/quay/master.txt for the failure reason: ``` time="2021-07-19T12:00:03Z" level=error msg="Failed to copy container image: Error in copy the image: Error initializing source docker://trunk.registry.rdoproject.org/tripleomaster/openstack-designate-worker:ec48e22f7ecb7ab5150d08a942860b22_x86_64: error pinging docker registry trunk.registry.rdoproject.org: Get \"https://trunk.registry.rdoproject.org/v2/\": dial tcp 38.102.83.107:443: connect: connection refused" time="2021-07-19T12:00:03Z" level=info msg="Copying image tripleomaster/openstack-designate-worker:ec48e22f7ecb7ab5150d08a942860b22" ``` This might happen because we reach the quota for api calls on quay, and you can wait a little bit and try again, or run the copy command to copy this particular container, and this particular hash: * Log into toolbox as root ``` ssh root@toolbox ``` * Enter into copy quay directory ``` cd /root/copy-quay ``` * Source the credentials ``` source /etc/quayrc ``` * Copy the container Now, the copy container have a lot of options, you can use --help to check each of those: ``` ./copy-quay --help Copy a container from one location to another Usage: copy-quay [command] Available Commands: copy Copy images from source to destiny help Help about any command tag Tag images Flags: --debug Enable debug output --from-namespace string Namespace of pushed image (default "tripleomaster") --hash string Hash to be pulled/pushed -h, --help help for copy-quay --job string Job to collect the list of containers --pull-registry string Registry to pull images from (default "trunk.registry.rdoproject.org") --push-hash string Hash to be pulled/pushed --push-registry string Registry to push images to (default "quay.io") --release string Release (default "master") --to-namespace string Namespace of pushed image (default "tripleomaster") --token string Token to use with quay api --zuul-api string Zuul api endpoint (default "https://review.rdoproject.org/zuul/api/") Use "copy-quay [command] --help" for more information about a command. ``` To copy only the openstack-designate-worker container with the hash ec48e22f7ecb7ab5150d08a942860b22_x86_64, you will execute the following: ``` ./copy-quay --from-namespace tripleomaster --to-namespace tripleomaster --release master --token $TOKEN --hash ec48e22f7ecb7ab5150d08a942860b22_x86_64 copy openstack-designate-worker ``` And the output: ``` Copying blob 61bd84a9108e skipped: already exists Copying blob dc0deb7c6c28 skipped: already exists Copying blob c697821d25a3 skipped: already exists Copying blob 92bf32900741 skipped: already exists Copying blob 1615f362c3b9 skipped: already exists Copying blob 782b2b55190b [--------------------------------------] 0.0b / 0.0b Copying config 7a2d56edb1 [======================================] 11.2KiB / 11.2KiB Writing manifest to image destination Storing signatures ``` The $TOKEN is stored in /etc/quayrc As you can see, you need to parse the --from-namespace and --to-namespace, this are the namespace from quay and rdo, usually is tripleorelease. In the case above, was tripleomaster, and you also need to tell the release, in this case master. The hash you want to copy, otherwise, it will check the latest hash available. then the copy command, and the container name. If you do not pass the container after the copy command, it will look for the list of containers in a specific job and copy all the containers. ## User workflow - Tagging Tagging is similar to copy however, instead of the copy command, you will call tag command, it also check the list of containers from the latest successfull run, and the DLRN api for latest hash. If you want to tag train8 for example (train have two releases, train that is centos 7 release, and train8 that is centos 8 release) you need to run the following ``` /copy-quay --from-namespace tripleotraincentos8 --to-namespace tripleotraincentos8 --token $TOKEN --release train8 tag ``` An the output is something similar to this: ``` INFO[0000] Promoted hash: 2a68d3b9e14d86b57db95487cadce0e2 INFO[0000] Job: periodic-tripleo-ci-build-containers-ubi-8-push-train ERRO[0001] URL not found: https://logserver.rdoproject.org/openstack-periodic-integration-stable4/opendev.org/openstack/tripleo-ci/master/periodic-tripleo-ci-build-containers-ubi-8-push-train/0641964/logs/containers-successfully-built.log INFO[0001] Fetching logs in https://logserver.rdoproject.org/openstack-periodic-integration-stable4/opendev.org/openstack/tripleo-ci/master/periodic-tripleo-ci-build-containers-ubi-8-push-train/0641964/logs/containers-successfully-built.log INFO[0001] Tagging tripleotraincentos8/centos-binary-swift-proxy-server with tag current-tripleo and manifest sha256:9637f9179d7c6a40e79e53414f3fe8e98f194b3d656e8ae17074b95477c1e040 "Updated" INFO[0002] Tagging tripleotraincentos8/centos-binary-swift-proxy-server with tag current-tripleo and manifest sha256:9637f9179d7c6a40e79e53414f3fe8e98f194b3d656e8ae17074b95477c1e040 "Updated" ``` Where 2a68d3b9e14d86b57db95487cadce0e2 is the promoted hash, that is retrive via DLRN api. You can chec accessing https://trunk.rdoproject.org/api-centos8-train/api/promotions?promote_name=current-tripleo&limit=1 for example. Then it check for logs of the latest successfull periodic-tripleo-ci-build-containers-ubi-8-push-train job. The ERRO URL not found is fine, since we check for two different logs for the list of containers due the different ways to build the containers with kolla (old releases). After that, you can see it started to tag the containers on quay. If you want to tag only a particular container, you can do so passing the container name after the tag command. You can also force to tag parsing the --force-hash option. ## Troubleshooting Add workflows here as new different errors appears ### Docker.io containers missing Recently there was an issue where docker.io containers for current-tripleo wasn't available, so, in order to copy it from quay.io to docker.io, you can run the following command: ``` copy-quay --pull-registry quay.io --push-registry docker.io --from-namespace tripleomaster --to-namespace tripleomaster --push-hash 07715e073191d94abc2f35e6b90563f9 --hash 07715e073191d94abc2f35e6b90563f9 --job periodic-tripleo-ci-build-containers-ubi-8-push copy ``` This will check the job periodic-tripleo-ci-build-containers-ubi-8-push for the list of the containers to be coppied, the --pull-registry is from where you want to pull, in our case quay.io, but it could be from trunk.rdoregistry as well. The --push-registry is where we want to copy the containers to. and --from-namespace is the namespace, in docker is docker.io/tripleomaster and quay is quay.io/tripleomaster as well, so, --from-namespace and --to-namespace are the same in this case. The --push-hash is the hash you want to push, because you can put for example current-tripleo here, so that's the reason we have two hashes options and both are the same, we could say, i want the hash 0771 to be pushed as current-tripleo for example, or whatever else you want to. If you don't pass nothing after the copy, it means it will copy all the containers found in the periodic job, this is just to generate the list of containers.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully